Read / Write Port by byte via Tris
#1
Posted 23 October 2012 - 03:30 AM
#2
Posted 23 October 2012 - 05:21 AM
#3
Posted 23 October 2012 - 12:53 PM
How can I read and write the Tris ports via a byte. Common functionality on most micro controllers however I can not figure it out on the Netduino.
Arduino example:
DDRB = 0xFF; // Set PortB to outputs.
In Netduino:
static OutputPort[] DDRB_8 = new OutputPort[8]; DDRB_8[0] = new OutputPort(Pins.GPIO_PIN_D0,True); : : : DDRB_8[7] = new OutputPort(Pins.GPIO_PIN_D7,True)
In PORTB = 0x00; // Set all pins to low(clear all PORTB). U don't needed to do this
Hope that help!
#4
Posted 24 October 2012 - 02:18 AM
#5
Posted 24 October 2012 - 03:54 AM
#6
Posted 24 October 2012 - 05:54 AM
I must admit that although I've been doing this with the STM8's for a while now it's only just occurred to me how useful it could be to be able to latch data onto a number of OutputPorts in a single step. Alright, we could probably write a class which does this but it would not be instantaneous because of the nature of NETMF.This is something that could be added as a native code addition to the firmware. Just FYI.
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#7
Posted 25 October 2012 - 05:13 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users