Drop a Parallax Propeller processor onto an Arduno board and what do you get?
Meet the ASC board - Arduino Shield Compatible Propeller board – from Martin Hodge.
- Eight independent 32 bit processor called COGS.
- Each with 2048 bytes or RAM (512 registers of 32 bits each)
- HUB that provides another 32K bytes or RAM (8k x 32 bits) and 32k bytes of ROM (8k x 32 bits).
- Software selected clock speeds of up to 80 MHZ.
- Fourteen Arduino compatible, current protected 3.3 v digital I/O pins
- PWM, I2C, SPI, UART and more, in any combination on any pin.
- 3.3 v AUX port for extra digital I/O or TV / keyboard / mouse or VGA using only a few resistors.
- Analog Inputs via MCP3208 12-bit analog to digital converter
- 64 KB EEPROM (32 K for program + 32 K for data storage)
- USB programming port can also power the board for rapid development.
- 3.3 volt and 5.0 volt regulators on board
The LCD Project:
This project adds a two-line LCD display to the ASC system.
Since the display is a receive only serial device only three wires are needed –
Power, ground, and Serial-TX.
The display runs on 5Vdc. Power and ground are connected to the POWER header.
Our serial port is created in software using a driver from the Propeller Object Exchange (OBEX)
called “FullDuplexSerial.spin”.
For this example the TX output is assigned to pin 23, which is brought out on the AUX header.
(see the board pin diagram).
Serial Driver:
In the example code note that the driver object is named in the OBJ section of the SPIN editor.
Note how the alias "LCD" is assigned to this object.
The TX pin is assigned the value of 23 in the CON section (Constants).
And the driver is started in the first line of Demo (the PUBlic method).
LCD.start(TxPin, TxPin, %1000, 9_600)
This invokes the start procedure in FullDuplexSerial object and passes the needed parameters
to the driver code. We assign pin 23 to both TX and RX, since the LCD display does not talk back,
and run the serial port at 9600 baud.
Our project code communicates with the serial driver via LCD.tx for text, or LCD.dec for decimal numbers.
LCD.bin and LCD.hex are also available. Read through the file FullDuplexSerial.spin for more details.
Our Project Code:
Spin may be a bit strange looking but it is an easy to learn language.
There are five major sections:
OBJ, CON, PUB, PRI, DAT
The program starts at the first declared PUB block.
Note the indentation! That determines the program structure, or flow.
Everything after the repeat is indented to show that it goes in the repeat loop.
This demo project is called “PropellerPowerLCD.spin”.
It can be copied and pasted directly into the Parallax Propeller Tool (the programming IDE)
Here is the source code for the LCD project:
'-------------------------------------------------------------------------------------------------------------------------
OBJ ‘ names other objects and assigns alias
LCD : "FullDuplexSerial.spin"
CON ‘names constats and assigns values
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
TxPin = 23
PUB Demo ‘ our project code starts here
Repeat ‘ loop forever
LCD.tx(12) ' Clear the display
LCD.tx(17) ' Turn on backlight
LCD.tx(22) ' no cursor
LCD.str(String("ASC! Propeller Powered Arduino!")) ' First line
WaitCnt(ClkFreq *5 + Cnt) ' Pause 5 seconds
LCD.tx(12) ' Clear
LCD.str(String("Hey World! Whatcha doing? ")) ' First line
WaitCnt(ClkFreq *5 + Cnt) ' Pause 5 seconds
'-------------------------------------------------------------------------------------------------------------------------