Building A Vco Pic 16f628a

Status
Not open for further replies.

FABASQ

New Member
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.
 
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.
 
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.
 
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.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…