Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Abdul Malik Khan
Hi, what is the type and size of var? What error you are geting? On 4/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:Hiyas,How can I use the PORTB constant with variables? eg: while (1) {var = 1;PORTB = var}That is what I'm trying to acheive.I'd like to be able to do it with variableslike I

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Lars Noschinski
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2006-04-22 08:09]: How can I use the PORTB constant with variables? eg: while (1) { var = 1; PORTB = var } This will work. But after seven iterations (if var is (u)int8_t), var will be 0. That is what I'm trying to acheive. I'd like to be able to

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread unauthorized
On Sat, 22 Apr 2006 08:30:33 +0200 Lars Noschinski [EMAIL PROTECTED] wrote: * [EMAIL PROTECTED] [EMAIL PROTECTED] [2006-04-22 08:09]: How can I use the PORTB constant with variables? eg: while (1) { var = 1; PORTB = var } This will work. But after seven iterations (if var is

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Matthew MacClary
On Sat, Apr 22, 2006 at 07:29:10PM +1000, [EMAIL PROTECTED] wrote: This example doesn't, and I don't know why... I know it's specific to C, so that's why I'm asking here... When asking a question like this, it would be useful for you to describe exactly what you are seeing and what you

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Steve Meliza
I am new to C by the way, if it isn't evident already (: You might want to do some reading then. Try http://users.rcn.com/rneswold/avr/avr-tools.pdf and http://download.savannah.gnu.org/releases/avr-libc/avr-libc-user-manual-1.4.4.pdf Also good are many of the documents from Atmel:

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Kevin Cozens
[EMAIL PROTECTED] wrote: This doesn't work as expected... not sure why. I would like to keep the functions if possible, I'm thinking it has something to do with scope perhaps? I am new to C by the way, if it isn't evident already (: It has nothing to do with scope. It has more to do with

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Ned Konz
On Apr 22, 2006, at 2:29 AM, [EMAIL PROTECTED] wrote: On Sat, 22 Apr 2006 08:30:33 +0200 Lars Noschinski [EMAIL PROTECTED] wrote: * [EMAIL PROTECTED] [EMAIL PROTECTED] [2006-04-22 08:09]: How can I use the PORTB constant with variables? eg: while (1) { var = 1; PORTB = var } This

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Ned Konz
On Apr 22, 2006, at 9:20 AM, Matthew MacClary wrote: Here is how I would implement your program. I apologize in advance since I don't have a board available to try the code on. I hope that the main ideas are apparent, even if I didn't squash all the bugs. Here's a version of Matthew's

Re: [avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-22 Thread Ben Jackson
void change() { var = 1; } That's a shift, not a rotation, so var is going to become 0. while (1) { int var=1; while (var != 0) { PORTB = var; var = 1; } } Also, 'int var' is going to be 16 bits wide, so in this version which rotates the bit it's going to

[avr-gcc-list] Using PORTB with variables, PORTB = var

2006-04-21 Thread unauthorized
Hiyas, How can I use the PORTB constant with variables? eg: while (1) { var = 1; PORTB = var } That is what I'm trying to acheive. I'd like to be able to do it with variables like I do above, but it doesn't seem to work. Once I replace var with an actual number, it works as expected.