??? 05/18/06 22:23 Read: times |
#116577 - PLM/51 addressing |
Hi Experts;
I'm hacking away on a 8051 family processor using the Intel PLM51 compiler. Not knowing PLM very well I'm trying to write to 2 external i/o cards with located at the addresses below. Each card has 3 bytes of i/o - ports a,b, and c. Being a lazy C programmer this is how I did ... declare c4port_a byte at(0c200h) auxiliary; declare c4port_a byte at(0c300h) auxiliary; set_output: procedure(ptr, mask, state); declare ptr word, mask byte, state byte; declare valve based ptr byte; if state > 0 then valve = (valve or mask); else valve = (valve and not mask); return; end; write_output: procedure (index, state) public; declare index byte; declare state byte; declare port byte; declare shift byte; declare bitmask byte; /* bits 0-7 */ declare valveaddr word; /* calculate the port offset from index TBD 0...7: c4port_a byte 0 offset 8...15: c4port_b byte 1 offset 16...23: c4port_c byte 2 offset 24...31: c5port_a byte 3 offset 32...39: c5port_b byte 4 offset 40...47: c5port_c byte 5 offset */ port = 0; shift = 0; port = index / 8; /* calculate the outputs bitmask 0-7 */ bitmask = 1; shift = index MOD 8; if (shift > 0) then bitmask = SHL(bitmask, shift); /* addressing based from cards address */ if (port < 3) then valveaddr = .c4port_a + port; else valveaddr = .c5port_a + (port MOD 3); /* set the valve */ call set_output(valveaddr, bitmask, state); return; end; What's wrong with my call to set_output? Thanks; Wil; |
Topic | Author | Date |
PLM/51 addressing | 01/01/70 00:00 | |
Why ? | 01/01/70 00:00 | |
Why? | 01/01/70 00:00 | |
PLM/51 addressing | 01/01/70 00:00 | |
Looks like Pascal | 01/01/70 00:00 | |
PLM/51 addressing | 01/01/70 00:00 | |
Extend - not port | 01/01/70 00:00 | |
PLM/51 addressing | 01/01/70 00:00 | |
Ah... | 01/01/70 00:00 | |
a blind shot | 01/01/70 00:00 | |
PLM/51 addressing![]() | 01/01/70 00:00 |