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.

please help me to solve aproblem of pic16f628a

Status
Not open for further replies.

fs789

New Member
hellow
how are you
i have programmed pic16f628a to perform asimple application which is lightining ALED at A0 output.
the problem is : the circuit works only if i touch the pins of the pic or any metalic part of the circuit .
also the voltage at pin A0 output is small about 2 volts( instead of 5 volt).
can you help me to solve this problem please?????
I HAVE MADE THE ENTIRE CIRCUIT ON ABREAD BOARD FOR TESTING PURPOSES.
 
You've either designed it, programmed it, or built it, wrongly.

For a start, post the EXACT and FULL circuit diagram you're trying to build, plus the source code you've written.
 
You got to love them .rar best way to kill a good computer fast all most as bad as some cheap part site with pop ups in ever word.
 
Try this and see if it works it will blink a led from PORTA,0 to gnd put you a 150ohm resistor from the led to PORTA,0
Code:
	list      p=16f628A           ; list directive to define processor
	#include <p16F628A.inc>       ; processor specific variable definitions

	errorlevel  -302              ; suppress message 302 from list file

	__CONFIG   _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT

	cblock 	0x20 			;start of general purpose registers
		d1
		d2
		d3
	endc
    org 0x0000
init: 
	CLRF 	PORTA ;Initialize PORTA by setting output data latches
	MOVLW 	0x07 ;Turn comparators off and
	MOVWF 	CMCON ;enable pins for I/O
	banksel TRISA  ; switch to bank1
	movlw 	b'00000000'	; set outputs
	movwf 	TRISA		; load value
	banksel PORTA		; switch bank0
	movlw	b'00000000'	; set all low
	movwf	PORTA


start:
	bsf PORTA,0			;turn on led 
	call delay			; 1/2 sec delay
	bcf PORTA,0			;turn off led
	call delay			;one more 1/2 sec delay
	goto start			; keep doing it till you turn off power
delay			;499994 cycles
	movlw	0x03
	movwf	d1			; the delay 
	movlw	0x18
	movwf	d2
	movlw	0x02
	movwf	d3
Delay_0
	decfsz	d1, f
	goto	$+2
	decfsz	d2, f
	goto	$+2
	decfsz	d3, f
	goto	Delay_0

			;6 cycles
	goto	$+1
	goto	$+1
	goto	$+1
     retlw 0x00
 end
 
Try this and see if it works it will blink a led from PORTA,0 to gnd put you a 150ohm resistor from the led to PORTA,0
Code:
	list      p=16f628A           ; list directive to define processor
	#include <p16F628A.inc>       ; processor specific variable definitions

	errorlevel  -302              ; suppress message 302 from list file

	__CONFIG   _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT

	cblock 	0x20 			;start of general purpose registers
		d1
		d2
		d3
	endc
    org 0x0000
init: 
	CLRF 	PORTA ;Initialize PORTA by setting output data latches
	MOVLW 	0x07 ;Turn comparators off and
	MOVWF 	CMCON ;enable pins for I/O
	banksel TRISA  ; switch to bank1
	movlw 	b'00000000'	; set outputs
	movwf 	TRISA		; load value
	banksel PORTA		; switch bank0
	movlw	b'00000000'	; set all low
	movwf	PORTA


start:
	bsf PORTA,0			;turn on led 
	call delay			; 1/2 sec delay
	bcf PORTA,0			;turn off led
	call delay			;one more 1/2 sec delay
	goto start			; keep doing it till you turn off power
delay			;499994 cycles
	movlw	0x03
	movwf	d1			; the delay 
	movlw	0x18
	movwf	d2
	movlw	0x02
	movwf	d3
Delay_0
	decfsz	d1, f
	goto	$+2
	decfsz	d2, f
	goto	$+2
	decfsz	d3, f
	goto	Delay_0

			;6 cycles
	goto	$+1
	goto	$+1
	goto	$+1
     retlw 0x00
 end

unfortunately,the programing was failed!!!!!!
can any one help me??
 
What failed?

The led blew up? The chip blew up? Or the led just not blinked (turned on)?
when using IC-PROG to store the hex file into the pic, the IC-PROG gave me ERROR MESSAGE :
verify failed at address 0000h!
although,it was programmed several times before now ,and with out problems.
is the pic become damaged?
 
Was the chip programmed with the same programmer? So there is a high chance that you chip is damaged. How did you connected the leds?
 
when using IC-PROG to store the hex file into the pic, the IC-PROG gave me ERROR MESSAGE :
verify failed at address 0000h!
although,it was programmed several times before now ,and with out problems.
is the pic become damaged?

Almost a year on, and you're still telling us absolutely nothing!. Most common reason for what you're finally mentioning (but still lacking vital details) is that your programmer isn't working - a VERY common problem if using the rubbish JDM type designs.
 
I think Nigel hit on it. I have gotten the same programming error on my JDM style programmer many times. It's why I also have a powered programmer. The JDM is temperamental.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top