4848
Newbie level 3
- Joined
- Jun 2, 2013
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,330
please help me out, i program pic16f628a with JDM2 programmer using Winpic8000 with my Laptop serial port. after the programm was sucessfull i put it into a circuit but it did not work. i try to reprogram it with anothe code i downloaded from the internet that is design for pic16f628a, but it does not work also. i re-programme it, it we be programm sucessfull, but yet it does not work please what should i do. the code i write to test the pic is
;testing programm for pic
#include "p16F628A.inc"
; CONFIG
; __config 0xFF38
__CONFIG _FOSC_INTOSCIO & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
org 0
goto Start
Start
bsf STATUS,RP0
clrf TRISB
clrf TRISA
bcf STATUS,RP0
movlw B'10101010'
movwf PORTB
movwf PORTA
Loop
nop
goto Loop
;
end
The other code i download is
MPASM Tutorial - LED Flash
LIST p=16F628A ;tell assembler what micro is in use
include "P16F628A.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the config settings (oscillator type etc)
cblock 0x20 ;start of general purpose registers
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
endc
LED Equ 0 ;set constant LED = 0
LEDPORT Equ PORTA ;set constant LEDPORT = 'PORTA'
org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off
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
clrf PORTA
clrf PORTB ;set all outputs low
Loop
bsf LEDPORT, LED ;turn on RA0 only
movlw d'250' ;delay 250 ms
call DelayMs ;this waits for a while
bcf LEDPORT, LED ;turn off RA0 only
movlw d'250' ;delay 250 ms
call DelayMs
goto Loop ;go back and do it again
DelayMs movwf count1 ;Move delay count to "count1"
d1 movlw 0xC7 ;delay 1mS
movwf counta
movlw 0x01
movwf countb
Delay_0
decfsz counta, f
goto $+2
decfsz countb, f
goto Delay_0
decfsz count1 ,f
goto d1
retlw 0x00
end
But yet it does not work, what went wrong
;testing programm for pic
#include "p16F628A.inc"
; CONFIG
; __config 0xFF38
__CONFIG _FOSC_INTOSCIO & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
org 0
goto Start
Start
bsf STATUS,RP0
clrf TRISB
clrf TRISA
bcf STATUS,RP0
movlw B'10101010'
movwf PORTB
movwf PORTA
Loop
nop
goto Loop
;
end
The other code i download is
MPASM Tutorial - LED Flash
LIST p=16F628A ;tell assembler what micro is in use
include "P16F628A.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the config settings (oscillator type etc)
cblock 0x20 ;start of general purpose registers
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
endc
LED Equ 0 ;set constant LED = 0
LEDPORT Equ PORTA ;set constant LEDPORT = 'PORTA'
org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off
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
clrf PORTA
clrf PORTB ;set all outputs low
Loop
bsf LEDPORT, LED ;turn on RA0 only
movlw d'250' ;delay 250 ms
call DelayMs ;this waits for a while
bcf LEDPORT, LED ;turn off RA0 only
movlw d'250' ;delay 250 ms
call DelayMs
goto Loop ;go back and do it again
DelayMs movwf count1 ;Move delay count to "count1"
d1 movlw 0xC7 ;delay 1mS
movwf counta
movlw 0x01
movwf countb
Delay_0
decfsz counta, f
goto $+2
decfsz countb, f
goto Delay_0
decfsz count1 ,f
goto d1
retlw 0x00
end
But yet it does not work, what went wrong