Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Building A Vco Pic 16f628a

Status
Not open for further replies.

FABASQ

New Member
:confused: 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.

Latest threads

New Articles From Microcontroller Tips

Back
Top