Update to BS2_Functions
Martin Hebel
Posts: 1,239
Here is an update to BS2 Functions.· Some notable highlights include:
· - Continual PWM using the counters·using PWM_Set and PWM_SetB (and regular PWM with duration)
· - EEPROM Write/Read·functions for·top of code space, normal code space (variable saves), and upper 32K (Thanks Paul Voss!)
· -·FREQOUT_SetB for second·Frequency continually
··- A bug fix on SERIN inverted data
For those who·use BS2_Functions, please let me know if I induced any bugs!· As always, don't forget to·BS2.Start(31,30) it!
I'll give it a few days to settle before updating the Object Library's code.
Thanks,·hope it helps some people!
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting Software
Southern Illinois University Carbondale, Electronic Systems Technologies
· - Continual PWM using the counters·using PWM_Set and PWM_SetB (and regular PWM with duration)
· - EEPROM Write/Read·functions for·top of code space, normal code space (variable saves), and upper 32K (Thanks Paul Voss!)
· -·FREQOUT_SetB for second·Frequency continually
··- A bug fix on SERIN inverted data
For those who·use BS2_Functions, please let me know if I induced any bugs!· As always, don't forget to·BS2.Start(31,30) it!
I'll give it a few days to settle before updating the Object Library's code.
Thanks,·hope it helps some people!
-Martin
Added functions for: FREQOUT_SetB(Pin, Freq) To sound a second tone on the defined pin continuously EEPROM Access: Read(Addr,size) where size is number of bytes (1 for byte, 2 for word ,4 for long) Read EEPROM in code space, from top (32767) to bottom (0) myVar := Read(0,4) ' long, 4 bytes Read_HighMem(Addr,size) where size is number of bytes (1 for byte, 2 for word ,4 for long) Read upper 32K of 64K EEPROM myVar := Read_HighMem(3,4) ' read a long, 4 bytes Read_CodeMem(Addr,size) where size is number of bytes (1 for byte, 2 for word ,4 for long) Read from direct code memory No coding required, variable or stack will have last value saved Write(Addr,Value, size) where size is number of bytes (1 for byte, 2 for word ,4 for long) Write to EEPROM in code space, from top (32767) to bottom (0) where 0 = top of memory Write(0, myData,4) ' write long myData to top of memory See precautions in method comments Write_HighMem(Addr,Value, size) where size is number of bytes (1 for byte, 2 for word ,4 for long) Write to upper 32K of 64K EEPROM Write_HighMem(0,myVal,2) ' write byte variable myVal to upper 32K lowest address See precautions in method comments Write_Code(MemAddr,Value, size) where size is number of bytes (1 for byte, 2 for word ,4 for long) Write to direct code memory Useful in having a variable survive a reset Write_I2C(@myData,myData,4) See precautions in method comments PWM: PWM_Set(Pin, Duty, Resolution) Sets continuous PWM on pin specified, for value and bit resolution specified PWM_Set(Pin, Duty, resolution) PWM_Set(2,500,10) ' 10 bit resolution, 0 to 1023 Duty PWM_SetB(Pin, Duty, Resolution) Sets wnd continuous PWM on pin specified, for value and bit resolution specified PWM_SetB(Pin, Duty, resolution) PWM_SetB(2,100,8) ' 8 bit resolution, 0 to 255 Duty PWM and PWM_100 functions have been adapted to use PWM_SetB. DEBUG: DEBUG_CR Sends a Carraige return for DEBUG (CR - ASCII 13) Note: FREQOUT and FREQOUT_Set use CounterA. FREQOUT_SetB uses Counter B PWM_Set uses counter A. PWM, PWM_100 and PWM_SetB use Counter B Counters can only be used for one purpose at a time (when ran from same Cog). Bug Fix: Actually inverted the data on SERIN when #INV mode is declared!! Thanks Glenn Tarbox! ... Hope I did it correctly, not tested!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting Software
Southern Illinois University Carbondale, Electronic Systems Technologies
Comments
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
No, I didn't change the order of the parameters, it would have broken compatibility with prior code using it. It's always best to look at the documentation when calling any method.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting Software
Southern Illinois University Carbondale, Electronic Systems Technologies