|
|
View previous topic :: View next topic |
Author |
Message |
Boon Guest
|
Problems with LCD driver by PIC 16F628. |
Posted: Sat Jul 10, 2004 1:29 am |
|
|
I have problems with LCD driver. I use PIC 16F628. input data from scan barcode . How can i do? |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: Problems with LCD driver by PIC 16F628. |
Posted: Sat Jul 10, 2004 3:50 pm |
|
|
Boon wrote: | I have problems with LCD driver. I use PIC 16F628. input data from scan barcode . How can i do? |
load your code onto PIC. connect barcode scanner to PIC. connect LCD to PIC. pass barcode under scanner. see results on LCD.
jds-pic |
|
|
Boon Guest
|
Thanks for the suggestion |
Posted: Sun Jul 11, 2004 7:28 pm |
|
|
Thanks for the suggestion. However, I want to also example by PIC C . Help me please. |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: Thanks for the suggestion |
Posted: Sun Jul 11, 2004 10:47 pm |
|
|
Boon wrote: | Thanks for the suggestion. However, I want to also example by PIC C . Help me please. |
you are not going to get any help at this rate. you've provided no description of your problem, no description of either your HW or SW architecture, no description of the errors that are occuring, no description of the troubleshooting steps that you've tried, no code snippets, etc etc etc ad nauseum -- and yet you want "example PIC C code". for what? an LCD driver? a barcode scanner driver ? basic PIC16F628 infrastructure?
summary:
we can't do your school project for you unless we see the assignment, and understand what resources are available.
jds-pic |
|
|
Boon Guest
|
|
Posted: Mon Jul 12, 2004 7:27 pm |
|
|
normally i use 16F877. i will change to 16F628 . it's error when compile. i want to known . what wrong? this my code
+++++++++++++++++++++++++++++++++++++++++
#include<16f877.h>
#fuses HS,NOPROTECT,NOWDT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include <lcd.c>
int i,value,min,max,j=0,k=0;
char msg1[5]="HELP",msg2[7]="NORMAL",msg3[5]="STOP",msg4[10]="NO_LOAD",msg5[]="OVER_LOAD";
void main(void) // Begin Program
{
printf("Sampling:");
setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );
do {
min=255;
max=0;
for(i=0;i<=30;++i)
{
delay_ms(10);
value = Read_ADC();
if(value<min)
min=value;
if(value>max)
max=value;
}
if (min<0x35) //**********NO_LOAD******************************************
{
j=j+1 ;
lcd_init() ;
lcd_getc(7,1) ;
printf(lcd_putc,msg1); // Output LCD HELP
lcd_getc(5,2) ;
printf(lcd_putc,msg4); // Output LCD NO_LOAD
delay_ms(1000);
printf(lcd_putc,"\f"); // Clear LCD
if (j >= 10 )
{
output_b(0x02);
lcd_getc(7,1) ;
printf(lcd_putc,msg3); // Output LCD STOP
lcd_getc(5,2) ;
printf(lcd_putc,msg4); // Output LCD NO_LOAD
break;
}
} //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (min>0x9a) //***********OVER_LOAD****************************************
{
j=j+1 ;
lcd_init() ;
lcd_getc(7,1) ;
printf(lcd_putc,msg1); // Output LCD HELP
lcd_getc(4,2) ;
printf(lcd_putc,msg5); // Output LCD OVER_LOAD
delay_ms(1000);
printf(lcd_putc,"\f"); // Clear LCD
if (j >= 10 )
{
output_b(0x02);
lcd_getc(7,1) ;
printf(lcd_putc,msg3); // Output LCD STOP
lcd_getc(4,2) ;
printf(lcd_putc,msg5); // Output LCD OVER_LOAD
break;
} //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
}
else
{
if ((min>0x35)&&(min<0x9a)) //***** Reset j value****
{
k=k+1;
{
lcd_init() ;
lcd_getc(k,1) ;
printf(lcd_putc,msg2); // Output LCD NOMAL
lcd_getc(k,2) ;
printf(lcd_putc,msg2); // Output LCD NOMAL
delay_ms(1000);
printf(lcd_putc,"\f"); // Clear LCD
j=0;
if (k>16)
k=0;
}
}
}
printf("\n\rMin: %2X Max: %2X j: %2d k: %2d\r\n ",min,max,j,k);
}while (TRUE);
} // End Program ******************************************************** |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
Posted: Mon Jul 12, 2004 8:03 pm |
|
|
Boon wrote: | normally i use 16F877. i will change to 16F628 . it's error when compile. i want to known . what wrong? this my code |
what's the error message?
jds-pic
ps:
please use the "Code" button when inserting code -- it makes it much more readable. |
|
|
Boon Guest
|
|
Posted: Tue Jul 13, 2004 7:28 pm |
|
|
Error message is
1: Use parameter value is out of range Not a number :PIN_C6
2: Undefined identifier
One error message i understand i change port_c is port_b . When compile it's show lcd.c page and error second message. I don't understand.What happen? |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Tue Jul 13, 2004 9:12 pm |
|
|
The code compiles fine for the 16F877 but will not compile for the 16F628 because you are trying to use analog channels it does not have.....
This chip will not work for what you want.... |
|
|
Boon Guest
|
|
Posted: Wed Jul 14, 2004 3:17 am |
|
|
Thank you .Yes,i know. this code for example . if i don't use analog channels .I want to know if i will use 16F628 for drive LCD. i will use LCD for show data. how i can do? i need help! please..... |
|
|
Guest
|
|
Posted: Wed Jul 14, 2004 4:04 am |
|
|
Look at the data sheet for the 16F628 - there are differences when compared to the 16F877.
You should be showing us the code you have when trying to compile for the 16F628. Get rid of the analog stuff, get rid of the #use rs232 line because the 16F628 uses pins RB2 for transmit and RB1 for receive, and you need to use port b for the lcd. |
|
|
Boon Guest
|
|
Posted: Thu Jul 15, 2004 7:17 pm |
|
|
I'm thank you Jds-pic, Dyeatman and Guest very much for the suggestion. Now i can use pic 16f628 with lcd . thank you very much |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|