These Nordic nRF24L01+ wireless modules are an excellent value at around $2 each. As usual, someone (Duane Degn) has already written code for testing these with the Propeller chip. There are eight pins on these as shown below. These modules are as effortless to use as the XBee at a tenth of the cost.
Generating some tunes on the Propeller chip is fun. I use a counter as a numerically controlled oscillator, feed the note frequencies, toggle the sound pin with a delay to play the note and repeat. The piezo speaker is connected to pin 6 of the Prop. I wrote similar code for a robot a few years ago as well. I’ll post a video of my Stingray robot along with that code soon.
CON _clkmode = xtal1 + pll16x _clkfreq = 80_000_000 PUB main cognew(@play_sound,0) DAT org play_sound or ctra,_nco ' set nco mode mov time,cnt add time,delay :init mov index,#notes ' address first item mov count,note_count ' # longs in notes array :load movs :get_freq,index ' move index address to :get_freq label or dira,s_pin ' set pin to output :get_freq mov frqa,0-0 ' move notes[index] into frqa waitcnt time,delay ' play (duration == delay - time to execute loop instructions) andn dira,s_pin ' set pin to input add index,#1 ' point to next note djnz count,#:load ' load next note jmp #:init ' stairway to heaven - led zeppelin notes long 094_489, 112_367, 141_574, 168_360, 089_186, 141_574, 112_367, 212_121 long 084_180, 141_574, 112_367, 112_367, 063_064, 126_128, 188_978, 149_992 long 074_996, 112_367, 094_489, 112_367, 141_574, 112_367, 094_489, 112_367 long 106_060, 094_489, 094_489, 094_489, 094_489, 094_489, 149_992, 141_574 ' little wing - jimi hendrix 'notes long 094_489, 063_064, 070_787, 070_787, 070_787, 084_180, 212_121, 141_574 ' long 070_787, 141_574, 212_121, 126_128, 126_128, 188_978, 212_121, 188_978 ' long 084_180, 212_121, 126_128, 084_180, 084_180, 168_360, 084_180, 070_787 ' long 168_360, 094_489, 126_128, 094_489, 094_489, 094_489, 188_978, 168_360 ' long 188_978, 070_787 ' fur elise - beethoven 'notes long 141_574, 133_628, 141_574, 133_628, 141_574, 105_629, 063_066, 056_184 ' long 094_489, 070_786, 094_489, 112_528, 141_574, 094_489, 105_629, 070_786 ' long 089_186, 070_786, 089_186, 105_629, 112_528, 070_786, 094_489, 141_574 note_count long $ - notes ' number of longs in notes array s_pin long 1 << 6 ' sound pin _nco long %00100 << 26 | 6 ' nco counter + sound pin delay long _clkfreq >> 2 ' sound delay time res 1 index res 1 ' index for notes array count res 1 ' loop counter fit ' Notes to frequencies [Note][Octave] ' C6 C#6 D6 Eb6 E6 F6 F#6 G6 Ab6 A6 Bb6 B6 ' 056_184, 059_524, 063_066, 066_814, 070_786, 074_995, 079_456, 084_181, 089_186, 094_489, 100_108, 105_629 ' C7 C#7 D7 Eb7 E7 F7 F#7 G7 Ab7 A7 Bb7 B7 ' 112_528, 119_049, 126_128, 133_628, 141_574, 149_992, 158_911, 168_360, 178_372, 188_978, 200_215, 212_121
Connected a couple of 44780 compatible 16 x 2 LCDs that came in my last order from Hong Kong. These LCDs are straightforward to solder and connect to the Propeller chip. There are a couple of objects already written for these, but I chose a PASM implementation by MagIO2. I stripped the fluff, demonstrating only four bit mode writing of text and scrolling. Potentiometers are added to the circuit for full control of brightness and contrast as well. The contrast on these is not as good as I had hoped.
I ordered one of these low cost(~$8) JY-MCU Bluetooth modules and hooked it up as soon as it arrived. After including the full duplex serial object, the code to interface the Bluetooth module is quite simple and is included below. Testing involved using the numbers 1-8 on the laptop via serial terminal to control the leds on the Propeller Demo Board pins 16-23 from a distance of about 20 ft. Nothing fancy, but for the price I am content knowing the module works correctly.
The 4.3″ touchscreen from Rayman is now up and running with a Propeller Proto Board. Connection requires 14 Propeller pins plus GND, 3.3V and 5V. The breakout board and the addition of headers on the Proto Board makes the task quick and easy. Tested with Ray’s PSB Paint program and a pen. The display size is adequate and the picture is clear. I hope to incorporate some of these into future projects.
Playing with procedurally generated graphics in assembler. Tested on 64 bit Win7 laptop Quad Core AMD A6-3400M APU w/Radeon HD Graphics 1.4ghz 6GB RAM at 1600×900. View fasm source.
Assembler game based on an old game called GridWars, where players write code to try to take over the grid of cpu’s. GridWars was coded in Parallel C. The ‘warrior’ begins at a randomly defined position in the grid, then attacks and defends grid locations with the goal of spreading into adjacent ‘cpu’ squares. Each cpu is aware of all surrounding neighbors, thus allowing the programmer / player to code interesting methods of attack or defense.
Propeller microcontroller disassembler. Single cog disassembler for PASM.
Propeller microcontroller assembler. Single cog assembler for PASM which includes Macro preprocessing. Very minimal Spin language allowed. i.e. Normal CON statements, like clkfreq and xinfreq, as well as cognew to kickstart the PASM. Binary output matches that of the Propeller Tool. WIP