Shop OBEX P1 Docs P2 Docs Learn Events
PropellerIDE PropBOE Voltage program — Parallax Forums

PropellerIDE PropBOE Voltage program

RsadeikaRsadeika Posts: 3,837
edited 2014-12-10 10:07 in Propeller 1
Have not made a code contribution in a while, so this is Propeller BOE Voltage Meter.spin setup for the PropellerIDE. I started with Simple ADC test.spin, that code is commented out and ended up with a version of voltage.spin. I am also thinking of making a conversion of this to C, but the lib would contain mostly commands that you would call to use the ADC aspect of the Propeller BOE.

For this particular program, I just have a wire connection between ADC(3) and the 5V socket, I do not have one of those devices to change the voltage stream, so all I really see is 5V. Now that the program works I will hook this up to an external power source, maybe like my window sill solar panel, and check and see if the program really works as expected.

I am running PropellerIDE on my Windows 7 box, and I do not have a problem with the text display, not sure what all the complaints were about in the other thread. The only thing that I noticed was when you hit return at the end of text line, it sometimes carries some text with it to the new line, not sure if this is a feature of some sort.

Ray
''****************************************************************************
'' Voltage.spin

''CON
''  _clkmode = XTAL1 + PLL16X
''  _clkfreq = 80_000_000
  
OBJ
 ser    : "Parallax Serial Terminal"
 system : "Propeller Board of Education"
 ''adc    : "PropBOE ADC"
 volts  : "PropBOE Voltmeter"
 time   : "Timing"
 
VAR
'' long ad
 
PUB Start
  system.Clock(80_000_000)  '' Set system clock to 80 MHz
  ser.Start(115200)         '' Setup serial terminal for debug

  repeat
''    ad := adc.In(3)
    Display
    time.Pause(250)
    
PUB Display
  ser.Home  '' Cursor to Home position
''  ser.Str(String("ad= "))
  ser.Str(volts.FloatStr(3))
''  ser.Dec(ad)
  ser.ClearEnd  '' Clear text to end of line

Comments

  • RsadeikaRsadeika Posts: 3,837
    edited 2014-12-10 10:07
    The other thing that I forgot to mention, the objects that are specific to the Propeller BOE ADC have to be downloaded from the Learn site, would be nice for the new people trying out PropellerIDE, if they were included in the initial install of the PropellerIDE. Once people get used to using the debug screen, they will love it, much better then trying to use PST, IMO.

    Ray
Sign In or Register to comment.