Well, after 5 months of telling myself I would get started, I finally did. I build the "MAIN" board from Nigels tutorial, installed MPLAB 8 (again), and went through the MPLAB tutorial to understand how the HEX file is created using the ASM file.
Finally got 1.1 done...the LED lit up (after I remembered to cut the tracks between the pins on the PIC socket....). I was elated, feeling like I was getting somewhere. I then modified the code and wrote in the Delays so I could actually SEE the LED blinking. I put my chip back in my JDM programmer (cheap one, but that is what I need at this point until I know I like this and won't get burned out trying to learn).
The programmer found the chip just fine, and I was able to erase the chip and program it with the new HEX file for 1.2. I transferred the chip to the MAIN board, but the LED still just shined....very strange. I then transferred it back to the JDM and the blasted thing couldn't be found.
I picked up a second chip, programmer finds it, I burn 1.2 on the chip, and I get the same results. Now the really odd thing is sometimes the programmer PWR led blinks at about the rate I expected the MAIN board to blink...but I can never detect the chip.
Here is the code for 1.2:
Any ideas what I am doing wrong? Anyone giving away another Junebug?
On a side note I quickly realized transferring the chip back and forth would be a pain, so I assembled a piggy-back module to utilize a ZIF 40 pin socket. Too bad I didn't realize my ZIF sockets were for a wide chip until I was finished.
Finally got 1.1 done...the LED lit up (after I remembered to cut the tracks between the pins on the PIC socket....). I was elated, feeling like I was getting somewhere. I then modified the code and wrote in the Delays so I could actually SEE the LED blinking. I put my chip back in my JDM programmer (cheap one, but that is what I need at this point until I know I like this and won't get burned out trying to learn).
The programmer found the chip just fine, and I was able to erase the chip and program it with the new HEX file for 1.2. I transferred the chip to the MAIN board, but the LED still just shined....very strange. I then transferred it back to the JDM and the blasted thing couldn't be found.
I picked up a second chip, programmer finds it, I burn 1.2 on the chip, and I get the same results. Now the really odd thing is sometimes the programmer PWR led blinks at about the rate I expected the MAIN board to blink...but I can never detect the chip.
Here is the code for 1.2:
Code:
;Tutorial 1.1 - Nigel Goodwin 2002
LIST p=16F648A ;tell assembler what chip we are using
include "P16F648A.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the configuration settings (oscillator type etc.)
cblock 0x20 ;start of general purpose registers
count1 ;used in delay
counta ;used in delay
countb ;used in delay
endc
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
call Delay ; this starts the wait
movlw 0x00
movwf PORTA
movwf PORTB ;set all bits off
call Delay ; again with the waiting
goto Loop ;go back and do it again
Delay movlw d'250' ;delay 250 ms (4mhz clock0
movwf count1
d1 movlw 0xC7
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
Any ideas what I am doing wrong? Anyone giving away another Junebug?
On a side note I quickly realized transferring the chip back and forth would be a pain, so I assembled a piggy-back module to utilize a ZIF 40 pin socket. Too bad I didn't realize my ZIF sockets were for a wide chip until I was finished.