Hi E,hi C,
Look at this demo, 5 ADC ports, using the serial Hserout tool.
The PIC view ADC values set for volts.
The Hserout are decimal values.
E
View attachment 156073
Hi E,hi C,
'0' in the context of being a ASCII = '0' = 0x30 = 00110000 its a value.
E
View attachment 156076
Hi E,hi C,
Check your GOTO's and GOSUB's, you are not 'entering and exiting' those routines correctly. Goto get_mess
If you are testing the Transmit routine, why are you calling Get Mess.?????
Thats a RXD input routine.
E
Hi E,hi C,
When your code makes a GOSUB call it Pushes the Return Address onto a Stack,[ where it is saved] so when it completes the GOSUB and RETURN's it Pops that Return address off the Stack and the program execution continues from that Address.
If you use a GOTO command which ends in a RETURN, if the Stack is empty you get Hardware Stack Underflow, because a GOTO does not Push an Address onto the Stack.
If there was an 'old' Address on the Stack, this incorrect Return address would cause a program crash.
E
Hi E,hi C,
Have you added or edited that program I posted.?
There is nothing in the code to cause a break.
E
E,hi,
The only section with ############# is this bit.??
E
######################################
ADCON0 = %00000001 'BIT0 = 1A/D EN This Selects AN0 thru AN5 [ you have set for AN0]
ADCON1 = %00001001 'AN0-AN5 SET TO ANALOG IN Correct
ADCON2 = % 1 x 100 100 'Set for Right Justify, 8 Tad , Fosc/4
'#############################################
How about this?
Hi E,hi C,
Look at the ADCON0 notes in the d/s.
You must enter all 8 Bits 0's or 1's to set up the ADC ADCON0 Byte correctly, [ bits 5 thru 2 select the channels] but the other bits also need to be set as required.
E
Hi E,Hi C,
Consider the bits 5 thru 2 of ADCON0 select the required channel.
You are programming for 6 channels, when you write the code below
The Oshonsoft Basic sets the correct ADC channel, prior to read from that channel.
This operation was shown in that demo program I posted, it read all the 6 channels OK.
Leave the ADCON0 as I set it.
E
Adcin 0, vpot1 '
Adcin 1, vpot2 'CH2
Adcin 2, vpot3
Adcin 3, vpot4
Adcin 4, vpot5
Adcin 5, vpot6
by Jake Hertz
by Jake Hertz
by Duane Benson
by Jake Hertz