Discussion in "PIC Microcontroller Discussion" started by    needginer    Mar 2, 2008.
Sun Mar 16 2008, 11:31 am
#21
but i cant compile it, and cant test with the LCD. with the linker problem :-) the linker problem is a problem in the code o the program?
Tue Mar 18 2008, 01:23 am
#22
its software's problem.. something might be missing.. please check what shyam said. the linker file..
Tue Mar 18 2008, 02:02 am
#23
thank. i can compile it already, because i missed some step when compile it before.
Tue Mar 18 2008, 02:40 am
#24
ok so things working without LCD part?
Tue Jul 29 2008, 02:15 pm
#25
Is this topic closed? if not i would like to add my doubts on my project im working on. Im doing a microcontroller based bidirectional visitor counter. Im using AT89C51, three 7-segments LEDS, one 74LS76 J-K flip flop, one LM324 quad op amp, IR transmitting LED, L14F1 npn phototransistor as my sensors and 2N3904 npn transistor. I would like to change the microcontroller to PIC16F877A and the 7 segments to LCDs. After that i will interface it with the PC with a serial port using RS232. I need some help on a few issues.
1) What pins should be reconnected when i change to PIC16F877A?
2) In AT89C52 i used 2 interrupts to detect the interruption of the sensors but for PIC16F877A i only have one interrupt to work with, how should i solve this?
3) what are the connections for the pins of the LCD?
Tue Jul 29 2008, 02:22 pm
#26
Additional info:
AT89C51 P0,P1,P2 is connected to the 7segments. Pin 40,Pin31 to 5V. P3 to 74LS76 pin 2. INT0 to 74LS76 pin 15. INT1 to 74LS76 pin 11. P3.1 to 74LS76 pin7. Pin 18 and Pin 19 connected to 12Mhz crystal. Pin20 to GND. For PIC16F877A what should be the changes?
Tue Jul 29 2008, 08:55 pm
#27
for sure PIC will not be pin compatible with 8051, try using polling for IR instead of interrupt or use three pins both anded and connected to interrupt, so whenever interrupt occurs you check which line caused the interrupt.

lcd connections will remain same. do check for the coding part.
Wed Jul 30 2008, 11:10 am
#28
The code for the AT89C51 is this
#include <AT89C51.h>
int i=o,j,k,l,m, a[]={63,6,91,79,102,109,125,7,127,,111};
void enter (void) interrupt 0
{
i++;
if(i>
999) i=999;
P3_1=1;
}
void exit (void) interrupt 2
{
i--;
if (i<0) i=0;
P3_0=0;
for (m=0;m<=1000; m++);
P3_0=1;
}
void main ()
{
IE=133;
TCON=5;
P3_0=1;
P3_1=1;
i=0;
while(1)
{
j=i%10;
k=i/10;
l=i/100;
k=k-l*10;
P2=a[j];
P0=a[k];
P1=a[l];
}
}

the schematic circuit is shown. what should i do if i wanna change it to PIC16F877A and LCD?




[ Edited Wed Jul 30 2008, 08:37 pm ]
Wed Jul 30 2008, 09:02 pm
#29
Its really a simple project...

Is it something like this.. you have two doors, enter and exit and your count increment/decrement when someone cross that IR signal.

its easy to port this on PIC. you while 1 will be something like this

while(1)
{
j=i%10;
k=i/10;
l=i/100;
k=k-l*10;
LCD_putchar(j+0x30);
LCD_putchar(k+0x30);
LCD_putchar(l+0x30);
LCD_putcmd(0x80); //back to first character
}


regarding IR reception..
connect your IR i/p to PIC like this..
      ____
----|        \_____INT Pin of PIC
----|____/

^its an AND gate

I/ps of AND gate will be your first IR, second IR and o/p is connected to INTR pin of PIC. so whatever IR goes low you will get interrupt on your MCU, in ISR read the status of both pins separately (IR inputs connected to any two GPIOs of PIC). this way you can do same thing as you done in above code, all you need to add is extra code for LCD instead of 7-segment.
Thu Jul 31 2008, 04:24 pm
#30
Are my connections correct for PIC16F877A?
Pin 11 and Pin 32 to 5V
Pin 26 to Pin 2 of 74LS76
Pin 1 to Reset
Pin 25 to Pin 11 of 74LS76
Pin 13 to 12Mhz crystal
Pin 14 to 12 Mhz crystal
Pin 31 to GND
and i use RB0 to RB7 and RD0 to RD7 to my LCD
IR input connect to AND and Output to interrupt pin 33 (RB0)
any other pins that need to be grounded or connect to 5v?

I wanna interface it to my pc with visual basic program. I need to add a RS232 to my circuit right? where should i connect it to? im using Microchip PIC KIT, MPLAB and ICD2

I connect the LCD based on the image given can?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am
ArnoldDiant
Fri Apr 26 2024, 03:53 am
RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm