I'm currently involved in a project where i've got a dip switch connected to a port on the micro and i need to read the value? first id like to just output to console and then in the future it will be the address of a node?
i was wondering if anyone can help me.
So far ive defined the port and tryed to just print the definition to the console but im getting the error invalid initializer ?
IF you are an AVR axmega god can you please keep on eye on this post because i might have alot of questions lol
ive just found out how to do it and lets just say its no way near as easy as the PIC lol. the way its done is all the register are defined and the bits defiend seperatly all over the place in diffrent files so you have to work through them to find out how to do it, where as with the pic its all defined for you, trising is an example.
Apparantly this is much better because it can be moved betweeen micros and other systems alot easier and people can understand it alot easier, say if i decided to die and someone took my place lol
DDRA=0xff; //sets direction to output on the whole port a
char data=PINA; //reads state of port A into the data variable
//you might also want pullups, which is done by seting PORT=0xff; but I am not too sure about that, so consult the datasheet.