Reply by Jerry Avins March 18, 20042004-03-18
Steve Underwood wrote:

> Jerry Avins <jya@ieee.org> wrote in message news:<4055c673$0$2816$61fed72c@news.rcn.com>... > >>Ricardo wrote: >> >>>>int main() { >>>> unsigned short i; >>> >>>You've defined it as a short, so it should be 8 bits. >> >>That depends on the processor. It will not be less than one addressable >>memory location. On many processors, that's 32 bits. In C, a byte is the >>size of a character or one addressable memory location, whichever is >>larger. > > > For the great majority of processors and compilers a short int or > unsigned short int is a 16 bit value, regardless of the word length of > the machine. However, the only thing you can pretty much guarantee is > a short int will not exceed the size of a long int. :-) > > Regards, > Steve
That's not strict adherence to ANSI C then. According to the ANSI standard, a byte is the greater of a character and the smallest addressable memory unit. sizeof() returns size in bytes. It never returns a fraction, and sizeof(char) returns 1 by definition. Eight bits holds an ASCII character, and octets can be individually addressed on a Pentium, so a Pentium C byte is an octet. Memory can be addressed only in 32-bit chunks on my DSP boards; for them, a C byte is 32 bits. For all other languages that I know about, "octet" and "byte" are synonyms. Actual integer sizes are not specified, but a char is not longer than a short, a short is not longer than an int, an int is not longer than a long, and a long is not longer than a double. Moreover, an int is at least 16 bits. When a char is one byte is 32 bits, all integer types but doubles are the same size. It's weird enough to want to reject, but that's how it is. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Reply by Steve Underwood March 18, 20042004-03-18
Jerry Avins <jya@ieee.org> wrote in message news:<4055c673$0$2816$61fed72c@news.rcn.com>...
> Ricardo wrote: > >> int main() { > >> unsigned short i; > > > > You've defined it as a short, so it should be 8 bits. > > That depends on the processor. It will not be less than one addressable > memory location. On many processors, that's 32 bits. In C, a byte is the > size of a character or one addressable memory location, whichever is > larger.
For the great majority of processors and compilers a short int or unsigned short int is a 16 bit value, regardless of the word length of the machine. However, the only thing you can pretty much guarantee is a short int will not exceed the size of a long int. :-) Regards, Steve
Reply by Jerry Avins March 15, 20042004-03-15
Ricardo wrote:

> Simone Winkler wrote: > >> Hello! >> > <snip> > >> >> int main() { >> unsigned short i; > > You've defined it as a short, so it should be 8 bits.
That depends on the processor. It will not be less than one addressable memory location. On many processors, that's 32 bits. In C, a byte is the size of a character or one addressable memory location, whichever is larger. In a 'C33, sizeof(char) = sizeof(short) = sizeof(long) = 1 = 32 bits.
>> XFMUX|=0x4000; >> XFDIR|=0x4000; >> >> while(1) { >> for(i=0;i<200000;i++); > > And you're trying to count with it uo to 200000. That's surely more than > 255. Have you looked at the asm generated? Probably this is being > optimized away, sice it does nothing. You might want to try to define i > as "volatile unsigned long", but even though it isn't a good delay > function, since you don't know how long it will be. > >> XFTOGGLE|=0xBFFF; >> } >> } >> >> What is wrong?? > > Gave my 2cents up. > > Ricardo
-- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Reply by kalki March 15, 20042004-03-15
Hi,

I guess the problem shd be with the EALLOW protection which is
provided to some of the GPIO registers. Check the data sheet to see
which of the GPIO registers are EALLOW protected. I guess GPxMUX,
GPxDIR and GPxQUAL are EALLOW protected. Just check it up. So,
unprotetct those registers and then configure , then only the regs.
will accept whatever data u give. U can check the register values
getting changed with respect to ur code in the watch window. Use
single stepping to see the change or use break points. I think this
should resolve ur issue.

Kalyani

"Simone Winkler" <simone.winkler@gmx.at> wrote in message news:<1079162725.82780@news.liwest.at>...
> Hello! > > I'm starting with the programming of a TMS320F2812 on a exDSP F2812 board. > There is a LED on this board, connected to the XF-pin of the DSP. > > The only thing I want to do is to say hello to the DSP-world and let the LED > blink. But it doesn't work!! > > As I understood, I have to look at the GPFIO14 bit. > But the GPIO-ports are multiplexed and I can't find out which setting is the > one I want. > Up to now I did this (which I think that is wrong, because the LED does not > blink): > > #define XFDIR *((volatile int *)0x70D5) > #define XFTOGGLE *((volatile int *)0x70F7) > #define XFMUX *((volatile int *)0x70D4) > #define XFSET *((volatile int *)0x70F5) > > int main() { > unsigned short i; > > XFMUX|=0x4000; > XFDIR|=0x4000; > > while(1) { > for(i=0;i<200000;i++); > XFTOGGLE|=0xBFFF; > } > } > > What is wrong?? > > There is also a jumper on the board that enables/disables the PLL function > (when it's enabled, the LED is on, otherwise it is off and as I understood > then the port pin can be used to control the LED by software. (right?) > > > THANK YOU! > > Simone
Reply by Ricardo March 15, 20042004-03-15
Simone Winkler wrote:
> Hello! >
<snip>
> > int main() { > unsigned short i;
You've defined it as a short, so it should be 8 bits.
> > XFMUX|=0x4000; > XFDIR|=0x4000; > > while(1) { > for(i=0;i<200000;i++);
And you're trying to count with it uo to 200000. That's surely more than 255. Have you looked at the asm generated? Probably this is being optimized away, sice it does nothing. You might want to try to define i as "volatile unsigned long", but even though it isn't a good delay function, since you don't know how long it will be.
> XFTOGGLE|=0xBFFF; > } > } > > What is wrong??
Gave my 2cents up. Ricardo
Reply by Simone Winkler March 13, 20042004-03-13
Hello!

I'm starting with the programming of a TMS320F2812 on a exDSP F2812 board.
There is a LED on this board, connected to the XF-pin of the DSP.

The only thing I want to do is to say hello to the DSP-world and let the LED
blink. But it doesn't work!!

As I understood, I have to look at the GPFIO14 bit.
But the GPIO-ports are multiplexed and I can't find out which setting is the
one I want.
Up to now I did this (which I think that is wrong, because the LED does not
blink):

#define XFDIR *((volatile int *)0x70D5)
#define XFTOGGLE *((volatile int *)0x70F7)
#define XFMUX *((volatile int *)0x70D4)
#define XFSET *((volatile int *)0x70F5)

int main() {
 unsigned short i;

 XFMUX|=0x4000;
 XFDIR|=0x4000;

 while(1) {
  for(i=0;i<200000;i++);
  XFTOGGLE|=0xBFFF;
  }
}

What is wrong??

There is also a jumper on the board that enables/disables the PLL function
(when it's enabled, the LED is on, otherwise it is off and as I understood
then the port pin can be used to control the LED by software. (right?)


THANK YOU!

Simone