thx. greatly appreciate ur answers. ________________________________________ From: Eric Decker [[email protected]] Sent: Friday, 30 August, 2013 2:54:26 PM To: He Dajiang (I2R) Cc: [email protected] Subject: Re: [Tinyos-help] IO configuration
On Thu, Aug 29, 2013 at 11:32 PM, He Dajiang (I2R) <[email protected]<mailto:[email protected]>> wrote: I did and found HplAtm128GeneralIOPinP.nc in folder: tinyos-2.1.2\tos\chips\atm128\pins. In the file: there are two macro fucntions: SET_BIT and CLR_BIT, which do what I am not 100% sure. That's why I asked. Sorry, not very familiar with direct MCU control. Here is what I did to answer the question of what does SET_BIT do... >From the top level of the source tree... grep -nHiR -e set_bit . And you'll something like... After a whole bunch of places where SET_BIT is used... ./tos/chips/m16c60/m16c60hardware.h:59:#define SET_BIT(port, bit) ((port) |= _BV(bit)) you can do something similar for _BV hope that helps you learn to fish :-) ________________________________________ From: Eric Decker [[email protected]<mailto:[email protected]>] Sent: Friday, 30 August, 2013 12:13:47 PM To: He Dajiang (I2R) Cc: Janos Sallai; [email protected]<mailto:[email protected]> Subject: Re: [Tinyos-help] IO configuration On Thu, Aug 29, 2013 at 6:45 PM, He Dajiang (I2R) <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote: thx, Janos. I used the following low level calls to make it work: cli(); PORTD = PORTD | 0x03; sei(); For you suggestion, I guess it is like SensorP.IO0 -> HplAtm128GeneralIOC.PortE0; // SCL SensorP.IO1 -> HplAtm128GeneralIOC.PortE1; // SDA However, I don't quite understand what the following calls do: call IO.makeInput(); call IO.set(); // is it high or low Call IO.set(1) leads to compiling error. First I would recommend reading the source code to answer your own question. I don't remember how things work on the MicaZ but the Msp430 does something similar. A given digital I/O pin can be programmed to behave differently. I.E. you can have it be an input or an output or connected to some different i/o h/w such as a UART or a SPI. The call to makeInput sets the h/w up so the pin referenced as "IO" is configured as an input. IO.set is a call that causes the pin to be set to a particular state. Typically ".set" will set the pin to a high state (set). .clear or .clr will set the pin to a low value. .set does not take a parameter and this is why "call IO.set(1)" gives you a compilation error. like I said earlier you really should have taken a look at the source code yourself and answered these questions yourself. when you make a build you can see exactly which files are being processed by doing "make verbose <platform>" eric ________________________________________ From: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> [[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>] on behalf of Janos Sallai [[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>] Sent: Thursday, 29 August, 2013 9:22:24 PM To: He Dajiang (I2R) Cc: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> Subject: Re: [Tinyos-help] IO configuration The best way to go is wiring the PortD interface of GeneralIOC, and using the commands of the interface to get/set the levels and directions of the pins. Janos On Thu, Aug 29, 2013 at 4:23 AM, He Dajiang (I2R) <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote: > Hi, > > For Micaz, what is the proper call to pull up the following two pins: > > PORTD0 and PORTD1 > > Is it SET_BIT(PORTD, 0x03)? > > Best Regards > > Institute for Infocomm Research disclaimer: "This email is confidential and > may be privileged. If you are not the intended recipient, please delete it > and notify us immediately. Please do not copy or use it for any purpose, or > disclose its contents to any other person. Thank you." > > _______________________________________________ > Tinyos-help mailing list > [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you." _______________________________________________ Tinyos-help mailing list [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help -- Eric B. Decker Senior (over 50 :-) Researcher Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you." -- Eric B. Decker Senior (over 50 :-) Researcher Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you." _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
