Novice..please Help!!!!

Status
Not open for further replies.

Anurag_Singh

New Member
I am making a simple led flasher using pic.
But the author has used PIC 16C84.
I am attaching the code here...please tell me what changes I have to make to use 16F628 instead of 16C84.
Help me as I am a novice.



LIST P=16C84
;
PORTB EQU 6
TRISB EQU 86H
OPTREG EQU 81H
STATUS EQU 3
CARRY EQU 0
RP0 EQU 5
MSB EQU 3
;
CLRF PORTB
BSF STATUS,RP0
CLRF TRISB^80H
MOVLW 0AH
MOVWF OPTREG^80H
BCF STATUS,RP0
INCF PORTB,F
BCF STATUS,CARRY
LEFT : SLEEP
RLF PORTB,F
BTFSS PORTB,MSB
GOTO LEFT
RIGHT : SLEEP
RRF PORTB,F
BTFSS PORTB,0
GOTO RIGHT
GOTO LEFT
END
 
Last edited:
where's the circuit diagram...

the site of Nigel gives a good tutorial of LED flasher but the circuit diagram is missing.
Please provide me with the diagram of connections as I am a novice.
 
Well...

well...

PIC 16f628 is same as PIC16f84...

all you have to do is to turn off the comparators at PIC16f628 in starting of program... rest everything is same...

Regards,

Simran..
 
See...

Hi,

See this example written by Sir Nigel Goodwin...


This simple program repeatedly switches all the output pins high and low - hence flashing the LED's.

Code:
Tutorial 1.1

This simple program repeatedly switches all the output pins high and low.

      	;Tutorial 1.1 - Nigel Goodwin 2002
	LIST	p=16F628		;tell assembler what chip we are using
	include "P16F628.inc"		;include the defaults for the chip
	__config 0x3D18			;sets the configuration settings 
					;(oscillator type etc.)

	org	0x0000			;org sets the origin, 0x0000 for the 16F628,
					;this is where the program starts running	
	movlw	0x07
	movwf	CMCON			;turn comparators off (make it like a 16F84)

   	bsf 	STATUS,		RP0	;select bank 1
   	movlw 	b'00000000'		;set PortB all outputs
   	movwf 	TRISB
	movwf	TRISA			;set PortA all outputs
	bcf	STATUS,		RP0	;select bank 0

Loop	
	movlw	0xff
	movwf	PORTA			;set all bits on
	movwf	PORTB
	nop				;the nop's make up the time taken by the goto
	nop				;giving a square wave output
	movlw	0x00
	movwf	PORTA
	movwf	PORTB			;set all bits off
	goto	Loop			;go back and do it again

	end

Here you can see that the comparators are turned off...

This example has been taken from

Regards,

Simran..
 
Wouter van Ooijen's site has a pretty good Blink a LED section. It has schematics and hex files for a bunch of different PICs. The source code provided is in JAL language though. Tis a decent language I guess but I've never done more than play with it a bit. Anyway, with the hex files and schematics provided, you can get some LED flashing happening quickly and easily and at least know your circuit and chip are working properly.
 
Last edited:
Question regarding circuit...

Thanks for the info..
But tell me that is it necessary to use voltage regulator IC 7805.
Can't I use a 5V dc power supply instead. Will it affect the circuit (given on **broken link removed**
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…