parallaxinc / cyberbot

Firmware, library, and loader code for cyberbot hardware
MIT License
8 stars 0 forks source link

D/A supported in library but not firmware #6

Closed AndyLindsay closed 5 years ago

AndyLindsay commented 5 years ago

@MatzElectronics. Per our discussion, I developed and added dac2ch and pwm2ch libraries and examples to the Simple Libraries Demo (.zip) branch.

Examples are in ...SimpleIDE/Learn/Examples/Devices/Convert/ and they are also documented in ...SimpleIDE/Learn/Simple Libraries Index.html. Multiple cogs with up to 2 channels each are supported, and you can also set channels to input with -1 in the dacVal (dac2ch) and tHigh (pwm2ch) arguments.

IMPORTANT: PWM generates a sawtooth on the D/A0 and D/A1 ports, so please make sure to use the dac2ch library for D/A on those ports. It also has higher resolution updates in less time with 12.5 ns/lsb vs 1 us/lsb with PWM. The pwm2ch library would be better for slow-ish transistors in H bridges and the like, and other situations where duty cycle control is needed.

MatzElectronics commented 5 years ago

@AndyLindsay Thanks!

MatzElectronics commented 5 years ago

Collapsing this into the PWM/finalize API issue.