CANbus reader 1Mbps.spin:
1. Start(rx_pin, tx_pin, sync_pin, bitrate)
Define the CAN-TX and CAN-RX pins, and set the bit rate.
The sync I/O pin lets the two cogs synchronize operations
via an I/O connection. Software can use the pin to
communicate between tasks. If both cogs start successfully,
this object returns the base address of the received data
array. If the cogs do not start, the start method returns the
Returns the Ident (ID) value, but does not wait for an ID
value to appear in the receiver buffer memory. It returns
the false condition if no ID was stored.
Returns the number of data bytes in
a CAN frame.
Returns the contents of the data
buffer, starting with the first byte.
Successive use of this method
returns the following bytes; second,
third, and so on. It does not return
“out-of-date” or old data. If the
current data buffer contains only
one byte, this method returns the
value in byte 0, and false for the
remaining bytes 1 through 7.
This method returns the address of
a length-prefaced string that contains the data in the
current receiver buffer.
Returns the Ident (ID) value in the next buffer, but it does
not wait for an ID to appear. It clears the previous ID to
zero. You use this method to advance to the next data
Set your mask value (if any) and as many as five filter
This method stops the CANbus reader 1Mbps object and
frees the reader and the cogs for other uses.
A CAN controller has more capabilities than covered
here. It will acknowledge receipt of a frame, identify frame
errors, keep bit-timing clocks synchronized, and identify
any defective CAN controllers on a bus. I’ll discuss those
and other topics in Part 2. NV
1. Corrigan, Steve, "Controller Area
Network Physical Layer
Requirements," SLLA270. Texas
Instruments, 2008; www.ti.com/lit/
2. Voss, Wilfried, "A Comprehensible
Guide to Controller Area Network,"
Copperhill Media, Greenfield, MA,
2008. ISBN: 978-0976511601;
The Propeller Object Exchange (OBEX) lists several CAN
files with methods that send and receive CAN frames; go
For an even simpler CAN test, visit
For more information about the Propeller IC and the Spin
language, see the Propeller Manual, version. 1.2 available
on the Parallax website www.parallax.com.
December 2016 33