F FABASQ New Member Jul 15, 2007 #1 I'm new to pic assembly and need a tip to finish my code. Two ports must output 30 khz running cpu in 4 or 10 mhz. But one should be inverted. It means that while one is high, the other is low. I'd appreciate any suggestions. Thanks.
I'm new to pic assembly and need a tip to finish my code. Two ports must output 30 khz running cpu in 4 or 10 mhz. But one should be inverted. It means that while one is high, the other is low. I'd appreciate any suggestions. Thanks.
P Pommie Well-Known Member Most Helpful Member Jul 15, 2007 #2 Code: Loop movlw b'00000001' movwf PORTB call Delay nop nop movlw b'00000010' movwf PORTB call Delay goto Loop You can find code for the delay routine on the piclist. For 30KHz your delay would be around 30 instruction cycles so you could just use NOPs. You would of course have to set the relevent bits of port b to output. Mike.
Code: Loop movlw b'00000001' movwf PORTB call Delay nop nop movlw b'00000010' movwf PORTB call Delay goto Loop You can find code for the delay routine on the piclist. For 30KHz your delay would be around 30 instruction cycles so you could just use NOPs. You would of course have to set the relevent bits of port b to output. Mike.
Brevor Member Jul 15, 2007 #3 Set up a shadow register with the 2 bits set complementary, every 16.5 us invert the register then write it to the output port.
Set up a shadow register with the 2 bits set complementary, every 16.5 us invert the register then write it to the output port.
F FABASQ New Member Jul 15, 2007 #4 I first tried the nested kind of loop, but did no goog. But I think this one will probabily work. Thank you for the tip.
I first tried the nested kind of loop, but did no goog. But I think this one will probabily work. Thank you for the tip.