serout to vfd
Gabrielroto
Posts: 7
I have a vfd (vacuum fluorescent display) that will accept serial strings from the BS2P. Like this SEROUT disp,16429,[noparse][[/noparse]"Hello World"]. I would like to serout a the contents of a variable but I'm not sure how. For instance: If the debug screen says adcres = 2500 then I want the 2500 to show on my vfd screen. Here's what I have so far.
HIGH cs
MAINIO
main:
DO
LOW cs
SHIFTIN dout, clk, MSBPRE, [noparse][[/noparse]adcRes\13] ' shiftin bits from 12 bit ADC
HIGH cs
adcres= adcres-6247*10
DEBUG adcRes,CR
SEROUT disp,16429,[noparse][[/noparse]adcRes] ' Trouble Here!!!!!!!!!!
PAUSE 100
GOTO main
LOOP
END
I want
HIGH cs
MAINIO
main:
DO
LOW cs
SHIFTIN dout, clk, MSBPRE, [noparse][[/noparse]adcRes\13] ' shiftin bits from 12 bit ADC
HIGH cs
adcres= adcres-6247*10
DEBUG adcRes,CR
SEROUT disp,16429,[noparse][[/noparse]adcRes] ' Trouble Here!!!!!!!!!!
PAUSE 100
GOTO main
LOOP
END
I want
Comments
See if this gives you what you want:
SEROUT disp,16429, [noparse][[/noparse]DEC 4 adcRes]
Check the syntax of the formatters (DEC is just one of many) either in the PBASIC Help File (within the IDE), or in the PBASIC Reference manual. Unfortunately I don't have either resource handy - sorry.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
As a note you would not be getting an output adcres = 2500 with the code you posted. The DEBUG screen would also have garbage using that format because you’re sending a raw binary value to it, rather than an ASCII string. The DEC formatter will work on both the DEBUG and SEROUT commands.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
This was for an LCD so I added a leading space when the temp is under 100 degrees to keep things lined up.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick