PIC16F877A Code problems
From: Devyn (devyntt_at_yahoo.com)
Date: 03/30/04
- Next message: nospam: "Re: Atmel TS80C32X2 Timer bug?"
- Previous message: Rainer Buchty: "Re: New series of PICs? (PIC19F4431)"
- Next in thread: Gary Kato: "Re: PIC16F877A Code problems"
- Reply: Gary Kato: "Re: PIC16F877A Code problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2004 09:34:24 -0800
Greetings Everybody!
I was trying to use the A/D module in PIC16F877A. I'm using a C
compiler (Hi-tech Picclite). The code i wrote passes values to PORTD.
The compiler declared the o/p of the ADC as ADRESH and ADRESL, "static
volatile unsigned char" type. The code I wrote was :-
char a,b;
//after adc conversion (which works)
//o/p right justified
a=ADRESH;
b=ADRESL;
PORTD=a; //works
PORTD=b; //doesnt work
PORTD=ADRESL; //works
What is happening? I suspected 'sign' problem, so i changed a,b to
"unsigned char", but the code still doesnt work. The register has MSB
= 1 usually (hence a sign problem?) Can anyone please help me out?
Thanks in Advance,
Devyn
- Next message: nospam: "Re: Atmel TS80C32X2 Timer bug?"
- Previous message: Rainer Buchty: "Re: New series of PICs? (PIC19F4431)"
- Next in thread: Gary Kato: "Re: PIC16F877A Code problems"
- Reply: Gary Kato: "Re: PIC16F877A Code problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]