Page 1 of 1

LPC812 Code help

Posted: Tue Apr 08, 2014 1:26 pm
by joec
Why won't this code toggle an output pin?
The text is printed to screen on each loop, but the output never changes.

#include "LPC8xx.bas"

#define LED_PIN IOCON_PIO0_15

DIM X AS INTEGER
X = 0

DIR(LED_PIN) = 1

WHILE X<30
OUT(LED_PIN) = X AND 1 ' IO() sets pin direction and state
X=X+1
WAIT(500)
PRINT "HELLO WORLD"
LOOP

Re: LPC812 Code help

Posted: Tue Apr 08, 2014 1:49 pm
by basicchip
change the #define LED_PIN

#define LED_PIN 15

The keywords OUT, IN, DIR all map 0-31 to P0.0-P0.31, OUT does not set the pin direction, it only writes to a pin that is an output by IO or DIR

Use IOCON_PIO0_15 as a register pointer

x = IOCON_PIO0_15