Get rid of Floating point. All will be much more smoother.
Either you like it or not, Richard has nailed the problems. If I were you, I would read carefully his suggestions.
Ioannis
Get rid of Floating point. All will be much more smoother.
Either you like it or not, Richard has nailed the problems. If I were you, I would read carefully his suggestions.
Ioannis
If I eliminated the floating point, the positive and negative voltages would NOT be the same as those recorded by the voltmeters in the Proteus simulation. attached proteus simulation image I also attach the old code when I started to make the code with the first code the negative and positive voltages are different. so i expanded the code and now the negative and positive voltages are flashing, but the negative and positive voltages that register on lcd 20 x4 are the same as the voltmeters in the proteus simulation. if it won't help don't comment
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_ SAMPLEUS 50
TRISC.6 = 0
TRISC.7 = 1
TRISA = 255
ADCON1 = %11000010
TRISB.6 = %0
LED VAR PORTB.6
B1 VAR WORD
B2 VAR WORD
VALOR1 VAR BYTE
VALOR2 VAR BYTE
STAR:
ADCIN 1, B1
ADCIN 2, B2
VALOR1=B1/9
VALOR2=B2/12
SEROUT2 PORTC.6,188,["$", "$", DEC4 B1,"$", "$",DEC4 B2,10,13]
LCDOUT $FE,2," SYMMETRIC FONT "
LCDOUT $FE,$C4," JOSE LUIS "
LCDOUT $FE,$90," VOLTAGE NEGATIVE:-",DEC2 VALOR1
LCDOUT $FE,$D0," VOLTAGE POSITIVE:+",DEC2 VALOR2
HIGH LED
GOTO STAR
10 bit adc @5v <=> .00488 volts per count
point A2 in sch = @1.76 v ie. 360 counts
360/12=30
this is the displayed result. what were you expecting
there is no visible relationship between A2 voltage and any other shown point in the sch.
how A1 voltage is derived is unknowable
pic vcc is a guess
Last edited by richard; - 18th July 2022 at 01:33.
Warning I'm not a teacher
just found this, no wonder i felt i had seen it all before
http://www.picbasic.co.uk/forum/showthread.php?t=24035
still finding the same lack of detail
Warning I'm not a teacher
Bookmarks