> Can anybody explain and help how to address P1.xx and P2.xx in OUTPUT(xx)
using MakrItC for SUPERPRO.
>
Details in the NXP user manual
Basically each 32 bit port has a DIR (direction register) and then SET and CLR
registers. To be an output the corresponding bit has to be 1. Then to output a
high write a 1 to the bit in the SET register, and for low write a 1 to the CLR
register.
The state of the pin can be read by either reading the SET or PIN register.
Definitions for these registers in LPC17xx.h
Ports beyond port 0 in C
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Ports beyond port 0 in C
Does that mean that P1.xx and P2.xx are NOT supported by OUTPUT and the other
built in functions?
built in functions?
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Ports beyond port 0 in C
Consider: what would you pass to OUTPUT to designate pin bank, and pin?
-MM
-MM
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Ports beyond port 0 in C
The higher ports didn't exist when the builtin functions were written. They
could be extended a number of different ways. Yes pins could be numbered 0 to
way higher than 32 and that could be mapped to pins. It would probably be the
most inefficient, though we may do that and share definitions with BASIC, C and
Sketchs. That is a work in progress.
If you'll notice OUTPUT is just a #define which maps 1 to 1 for P0. OUTPUT1..4
could be added, as HIGH, LOW could also be handled.
The LPC1756 is a very new part, and as NXP works out the kinks we will be
expanding our software as well.
> Consider: what would you pass to OUTPUT to designate pin bank, and pin?
>
> > Does that mean that P1.xx and P2.xx are NOT supported by OUTPUT and the
other built in functions?
could be extended a number of different ways. Yes pins could be numbered 0 to
way higher than 32 and that could be mapped to pins. It would probably be the
most inefficient, though we may do that and share definitions with BASIC, C and
Sketchs. That is a work in progress.
If you'll notice OUTPUT is just a #define which maps 1 to 1 for P0. OUTPUT1..4
could be added, as HIGH, LOW could also be handled.
The LPC1756 is a very new part, and as NXP works out the kinks we will be
expanding our software as well.
> Consider: what would you pass to OUTPUT to designate pin bank, and pin?
>
> > Does that mean that P1.xx and P2.xx are NOT supported by OUTPUT and the
other built in functions?
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Ports beyond port 0 in C
"If you'll notice OUTPUT is just a #define which maps 1 to 1 for P0. OUTPUT1..4
could be added, as HIGH, LOW could also be handled."
As i am C newbie could you please give an example how to do it ?
could be added, as HIGH, LOW could also be handled."
As i am C newbie could you please give an example how to do it ?
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Ports beyond port 0 in C
#define OUTPUT1(x) FIO1DIR |= 1<x
"If you'll notice OUTPUT is just a #define which maps 1 to 1 for P0.
OUTPUT1..4
"If you'll notice OUTPUT is just a #define which maps 1 to 1 for P0.
OUTPUT1..4