Page 1 of 1

Code for GPIO

Posted: Wed Mar 30, 2011 7:20 pm
by Simon
Hi, please could you show me a code example for testing the state of a single input pin? Your BLINKER code was very usefull for setting and clearing an output port pin.
While I'm at it, it would be very helpfull to have example code for the ADC, DAC and CAN bus. I'm using the OLIMEX P2378 dev board.
Great product BTW really enjoying getting to grips with it. Many Thanks :)

Re: Code for GPIO

Posted: Wed Mar 30, 2011 11:29 pm
by cfbsoftware
Simon wrote:Hi, please could you show me a code example for testing the state of a single input pin?
For examples see the discussion reading status inport in the Development Boards section of this forum:
viewtopic.php?f=7&t=60
While I'm at it, it would be very helpfull to have example code for the ADC, DAC and CAN bus. I'm using the OLIMEX P2378 dev board.
The Led7ADC example included in all editions of Astrobe displays a number in the range 0 to 9 relative to the rotation of a potentiometer connected to an ADC channel. It displays the reading as a single digit on a 7-segment LED that is connected directly to GPIO pins. Both of these devices are on the EA LPC2103 Education Board - I can't see anything similar already on the P2378 board so you would need to connect it up to something similar yourself if you wanted to adapt that example.

Source code of all the external library modules (including ADC) is included with the Personal and Professional Editions of Astrobe. They are supplied so you can use them as examples for writing your own low-level code (e.g. CAN or DAC) and so you can modify them to suit your own requirements.
Great product BTW really enjoying getting to grips with it. Many Thanks :)
Pleased to hear it :)