HI, I have a need to read sequential port pins (similar to a multiplexer) and output this logic level to a specific pin (C5), while outputting this index number to a separate port i.e. output a number 0 to 15(bits 0 to 4). The problem is how to index the port pin to be read from as JAL complains about pin_a(i) (where i is the index number).
Any help on this problem would be greatly appreciated I have included my code below include 16f887 -- target PICmicro -- -- This program assumes the internal oscillator -- is running at a frequency of 8 MHz. pragma target clock 8_000_000 -- oscillator frequency -- configuration memory settings (fuses) pragma target OSC INTOSC_NOCLKOUT --Int Osc no output OSCCON_IRCF = 0b_110 -- Postscaler runs at 4Mhz --pragma target OSC HS -- HS crystal or resonator pragma target WDT disabled -- no watchdog pragma target LVP disabled -- no Low Voltage Programming pragma target MCLR internal -- reset inxternally -- enable_digital_io() -- make all pins digital I/O alias Data is pin_C5 -- Specify the pin direction (i/p or o/p): portA_direction = all_input portB_direction = all_input portC_direction = all_output -- --Define Variables var byte i -- forever loop i=0 PortC = 0 while i <= 15 loop if i <= 7 then Data = pin_A(i) else Data = pin_B(i-8) end if portC = i i = i + 1 end loop end loop -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
