heina
Junior Member level 3
- Joined
- Dec 21, 2009
- Messages
- 25
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Philippines
- Activity points
- 1,471
uhm..
HI!
I have here a sample program but I can't seem to figure out how to simulate this on my oshon software's pic simulator. Nothing seems to happen whenever I load this program and try out different combinations of the input in Port A.
Any help would be very much appreciated..help is really needed..
Thank you very much.
Sincerely,
Heina
HI!
I have here a sample program but I can't seem to figure out how to simulate this on my oshon software's pic simulator. Nothing seems to happen whenever I load this program and try out different combinations of the input in Port A.
Any help would be very much appreciated..help is really needed..
Thank you very much.
Sincerely,
Heina
Code:
program ADC_on_LEDs
dim temp_res as word
main:
ANSEL = 0x04 ' Configure AN2 pin as analog
ANSELH = 0 ' Configure other AN pins as digital I/O
C1ON_bit = 0 ' Disable comparators
C2ON_bit = 0
TRISA = 0xFF ' PORTA is input
TRISC = 0 ' PORTC is output
TRISD = 0 ' PORTD is output
while (TRUE)
temp_res = Adc_Read(2) ' Get 10-bit results of AD conversion
PORTD = temp_res ' Send lower 8 bits to PORTD
PORTC = word(temp_res >> 8) ' Send 2 most significant bits to RC1, RC0
wend
end.