Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/21/10 07:46
Read: times


 
#179233 - Work with the port byte instead of bits
Responding to: ???'s previous message
If the LEDs are on the same port, then access the port as a byte, and perform normal or/and operations on the port.
If the LEDs are spread over multiple ports, you need a switch statement to decide which port to use.

Open the assembler manual and look at the available instructions. If the processor doesn't have an instruction where you store the bit index in a register, then you can't write generic code that toggles any bit. An assembler instruction where the bit number is hardcoded in the opcode means you need one such assembler instruction (corresponding C code) for every single bit. Or you need to work on byte level, to allow you to programatically select which of the 8 bits in a single port. But continue with byte-wise access for the port bytes - what assembler instructions does the processor have?

Basically, the instruction set of the processor puts a limit to what is possible to get a C compiler to do. What the processor can't address, a C compiler can't produce code for.

List of 2 messages in thread
TopicAuthorDate
arrays on port pins - how do I define it?            01/01/70 00:00      
   Work with the port byte instead of bits            01/01/70 00:00      

Back to Subject List