Page 1 of 1

Displaying array contents on LEDs

Posted: 16 Jul 2010 12:35
by Jimbotnik
Hello,

I have some code which writes either 1's or 0's to populate an array of integers (int MyArray[14]).

This compiles fine, but when I try to add some code to display the content of some of the array elements (PORTB.B0 = MyArray[0]) I get compilation errors.

What am I doing wrong?

Thanks for any guidance,

Jimbo

PS I am using the PIC5 Dev board with a PIC16F887 chip

Re: Displaying array contents on LEDs

Posted: 17 Jul 2010 12:58
by Sobrietytest
Each array element contains 1 byte (i.e. 8 bits) in your code you're trying to assign 8 bits to one bit location.

PORTB.B0 can only contain 1 or 0.

PORTB = MyArray[0]; would work.

Re: Displaying array contents on LEDs

Posted: 19 Jul 2010 12:40
by Jimbotnik
Thanks Sobrietytest - that's good to know. I will read up on different data type sizes