Hi!
Thanks a lot for your answer!

With the DDRB register, I set the output pins for PWM. In your code, this is
done by:

TOSH_MAKE_MOTOR1PWM_OUTPUT();
TOSH_MAKE_MOTOR1DIR_OUTPUT();
    
TOSH_CLR_MOTOR1PWM_PIN();
TOSH_CLR_MOTOR1DIR_PIN();

Where are those functions defined and how can I use them to get PWM to Port
OC1A and OC1B? Can I even use these functions without having the
cotsbots-board?

Furthermore I found that in a header file:

/** after cotsbots motor/hardware.h for PWM output: **/ 
// it appears that the PWM and DIR appellations are reversed 
//  and also that the pins assigned to PWM (sic) are not available 
//  due to their being used by the radio: 
//      PB1 -- SPI_SCK 
//      PB2 -- SPI_MOSI 
//  so gotta try somethong else.... 

TOSH_ASSIGN_PIN(MOTOR1DIR, C, 0);       // PC0 
TOSH_ASSIGN_PIN(MOTOR1PWM, B, 6);       // PB6 

TOSH_ASSIGN_PIN(MOTOR2DIR, C, 1);       // PC1 
TOSH_ASSIGN_PIN(MOTOR2PWM, B, 5);       // PB5 

So there seems to be problems to use radio and PWM together, because of
corporate use of PB registers.

Can I use TOSH_ASSIGN_PIN() without cotsbots-board in nesC? I tried to
compile and there were no errors. But will it work expectedly or do I have
to use any more header files like hardware.h?

Thanks a lot,
BiBe



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:tinyos-help-
> [EMAIL PROTECTED] On Behalf Of Michael Schippling
> Sent: Tuesday, July 25, 2006 6:14 AM
> To: Birger Becker
> Cc: [email protected]
> Subject: Re: [Tinyos-help] Problems with GenericComm and PWM
> 
> sbi() and cbi() should work fine, as long as you are careful
> to not touch pins used by the radio. I wouldn't go writing
> whole registers with outp() if there is any shared pins.
> Double check the schematic for the mote you are using to make sure.
> 
> I have some PWM code in my code bolus:
>      http://www.etantdonnes.com/Motes/robocode.tar.gz
> I forget what reg DDRB is, but I use the timer/counter pins
> on the ATMEGA 128 so either I did something right, or you don't
> need to touch DDRB...
> 
> MS
> 
> 
> 
> Birger Becker wrote:
> > Hi!
> > I'm currently programming PWM (pulse width modulation) on an ATMega 128
> in a
> > tinyOS-environment. Programming of PWM is ready, but now I wanted to
> remote
> > control one Mote with the PWM by another, which is connected to a
> > programming board.
> >
> > So I used TOSBASE and SimpleCmd for basic and put my PWM code in the
> > command-process of SimpleCmd. The TOSBase-Mote is then administrated by
> > programming board using UART and it sends commands via RadioCRCPacket to
> > SimpleCommand, which receives them by GenericComm. The remote control
> works
> > fine, I checked by LEDs.
> >
> > To realize PWM, I used register DDRB of ATMega 128 to set output-Pins.
> But
> > when any bit of this register is set to 1, no Radio-Packets will be
> received
> > anymore.
> >
> > Code like outp(0x20, DDRB) (in tinyOS 1.1.0) and manually set bits by
> sbi()
> > and cbi() (in tinyOS 1.1.11) results the same curious effect.
> >
> > How does GenericComm or RadioCRCPacket use DDRB-register and how can I
> use
> > PWM-ports without getting every Radio-Connection crashed.
> >
> > Many thanks,
> > BiBe
> >
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-
> help
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to