View Single Post
  #3   Spotlight this post!  
Unread 16-09-2005, 00:43
sciguy125 sciguy125 is offline
Electrical Engineer
AKA: Phil Baltar
FRC #1351
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Sunnyvale, CA
Posts: 519
sciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond repute
Send a message via AIM to sciguy125 Send a message via MSN to sciguy125 Send a message via Yahoo to sciguy125
Re: Addressing I/O in Sections

I fully agree with Brian's assessment. Here's a little primer on PICs:

All the I/O lines are grouped into "ports". Each port can be viewed as a memory address. Each line corresponds to a bit in the char stored at the address. If you change whatever is at the address, you change the respective lines. If you look at the block of code in ifi_aliases.h starting at line 109, you can see which digital I/Os correspond to which ports on the processor. You'll notice that the biggest set of digital I/Os is only 7 bits wide.

As Brian pointed out, if you really need all 8 bits, it shouldn't be too hard to just write a function to handle each bit individually. Maybe something along the lines of
Code:
digital_io_01 = my_char >> 7;
digital_io_02 = (my_char & 64) >> 6; //64 is binary 010000000
digital_io_03 = (my_char & 32) >> 5; //32 is binary 001000000
...
Google "bitwise operators" if you don't know about them.
__________________

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GE/S/P a-- e y-- r-- s:++ d+ h! X+++
t++ C+ P+ L++ E W++ w M-- V? PS+ PE+
5- R-- tv+ b+ DI+++ D- G
------END GEEK CODE BLOCK------

Last edited by sciguy125 : 16-09-2005 at 00:55.