LPC812 Code help

Questions about the BASICtools and MakeItC
Post Reply
joec
Posts: 1
Joined: Wed Mar 26, 2014 6:00 pm

LPC812 Code help

Post 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



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: LPC812 Code help

Post 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

Post Reply