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.

JDM Programmer not detecting after Nigel Tutorial 1.2??

Status
Not open for further replies.
What are you trying to build? Why are you playing with the O2 sensor?

I am building a "control box" for a motorcycle, incorporating different modifications that I want to make into one unit. The O2 sensor would be to read the Air/fuel mixture in real time....nothing actionable, just translating the very small voltage signal to a value.
 
When incorporating an LCD display, and or LED's you will easily be over the pin budget of the 16f88. With an LCD in 4 bit mode, 6-7 pins are required alone. When completing the individual tasks at hand, a much larger device will become apparent. An 18fxxxx device and a high level language would be my choice to run the show, but that is a whole topic unto itself that gets discussed frequently on this forum.

My suggestion would be to buy the Pickit 2 programmer kit, which includes the low pin count board. To run through Nigel's tutorials, solder a 18 pin DIP socket to the proto area of the LPC, and hookup the Vdd, Vss, 0.1uf bypass cap, and ICSP connections. Add female 0.100" headers for on board analog pot/led's, and off board (i.e. breadboard) connections. Insert 18 pin device of choice and you are ready to go.

I had a feeling the LCD/LED part would push it over the edge. That is part 3 of the project, and I am still on part 1, so no rush learning the high level language just now...

I am looking at the PICKIT 2 programmer kit, as it seems to cover what I need and be well supported. Is it fairly well documented where to hook up the VDD, Vss, the bypass cap and the connections? I am pretty sure I can get it wrong....
 
Use a much larger PIC, no need to squeeze a small 18pin PIC. Use a 18F2525 so you don't have to mux pins.

The PK2 is a good choice.
 
I had a feeling the LCD/LED part would push it over the edge. That is part 3 of the project, and I am still on part 1, so no rush learning the high level language just now...

I am looking at the PICKIT 2 programmer kit, as it seems to cover what I need and be well supported. Is it fairly well documented where to hook up the VDD, Vss, the bypass cap and the connections? I am pretty sure I can get it wrong....
The connections for ICSP are well documented in the Pickit 2 user guide/schematic. You can download that guide from Microchip to get familiar with it now. Some simple point to point wiring (22 gauge is fine) underneath the board is all that is required. Solder the five pins of the Pickit 2 programming header MCLR, Vdd, Vss, PGD, and PGC respectively to the appropriate 18 pin device socket pins. Get the data sheet downloaded for the device used, to determine the pin-out orientation and locations. The 0.1uf cap across the Vdd and Vss pins of the DIP socket would provide cheap insurance. The 0.100" female header sockets are aligned along each side the 18 pin DIP socket, so the pcb pins can easily be bridged on the underside without wire.

Pay attention to where the no. 1 pin is at all times. The DIP socket will have an indentation like :--U--: at the top, where the dot of the no. 1 pin is supposed to mate. Only one device in a socket or on the board at one time.
 
I figured it out!!!


I still want to get a better programmer, but I figured out how to reprogram the 16F648A with my JDM.

I inserted a fold of paper on pin 4 when I inserted the chip. I then used a switch with a wire from pin 4 the VDD pin on the connector (which I think is for in circuit programming?)

PICPgm could then see the chip, and I was able to erase it. Once erased I could remove the paper and it can still see it!

The way I have to do it is:

Have PICPgm detecting the programmer.
Use a chip socket with pin 4 bent out, and connected to a thin wire.
connect other end of thin wire to switch, then to VDD pin

close switch, and click the "Erase" button.

Close switch to program as well.....working like a charm although I have one chip I can't get to clear.
 
Last edited:
I am just about finished with Tutorial 1...trying to learn all I can. I tried this code, but it freezes at the start of my second table. I am sure I am doing something silly and small wrong....can anyone shed some light?

Code:
;Tutorial 1.5 - 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
			count				;used in table read routine
			count1 				;used in delay routine
			count2
			counta 				;used in delay routine 
			countb 				;used in delay routine
		endc

		LEDPORT	Equ		PORTB	;set constant LEDPORT = 'PORTB'
		LEDTRIS	Equ		TRISB	;set constant for TRIS register
	
		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 	LEDTRIS
		bcf		STATUS,		RP0	;select bank 0
		clrf	LEDPORT			;set all outputs low

Start	clrf	count			;put counter value in W
Read	movf	count, w		;put counter value in W
		call	Table
		movwf	LEDPORT
		call	Delay
		incf	count, w
		xorlw	d'18'			;check for last (18th) entry
		btfsc	Status, Z
		goto	Read2			;if start from beginning
		incf	count, f		;else do next
		goto	Read
		
Table	ADDWF	PCL, f			;data table for bit pattern
		retlw	b'10000000'
        retlw   b'11000000'
		retlw   b'11100000'
        retlw   b'01110000'
        retlw   b'00111000'
        retlw   b'00011100'
        retlw   b'00001110'
        retlw   b'00000111'
        retlw   b'00000011'
        retlw   b'00000001'
        retlw   b'00000011'		
        retlw   b'00001110'
        retlw   b'00011100'
        retlw   b'00111000'
        retlw   b'01110000'
        retlw   b'11100000'
		retlw   b'11000000'
		retlw   b'10000000'

Read2	clrf	count2
		movf	count2, w		;put counter value in W
		call	Table2
		movwf	LEDPORT
		call	Delay
		incf	count2, w
		xorlw	d'13'			;check for last (13th) entry
		btfsc	Status, Z
		goto	Start			;if start from beginning
		incf	count2, f		;else do next
		goto	Read2
		
Table2	ADDWF	PCL, f			;data table for bit pattern
		retlw	b'10000001'
        retlw   b'11000011'
		retlw   b'11100111'
        retlw   b'01111110'
        retlw   b'00111100'
        retlw   b'00011000'
        retlw   b'00000000'
        retlw   b'00011000'
        retlw   b'00111100'
        retlw   b'01111110'
		retlw   b'11100111'		
        retlw   b'11000011'
		retlw	b'10000001'
		
		
Delay	movlw	d'250'			;delay 250 ms (4 MHz clock)
		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

In addition, at the end of the loop it takes slightly longer to restart...how can I "smooth" it out?
 
You are not getting further than picking up the first item of data in Table 2 as you are clearing a register and always going to Table 2, and picking up the first byte.

You must increment the table pointer to get to the other bytes of data.
 
Last edited:
I was attempting to set up more than 1 loop, so I could call each loop a different number of times, to vary the display a bit. How is this best accomplished? Can I only have 1 table?
 
I was attempting to set up more than 1 loop, so I could call each loop a different number of times, to vary the display a bit. How is this best accomplished? Can I only have 1 table?

Code:
Read2	clrf	count2
[COLOR="Red"]Read22[/COLOR]
		movf	count2, w		;put counter value in W
		call	Table2
		movwf	LEDPORT
		call	Delay
		incf	count2, w
		xorlw	d'13'			;check for last (13th) entry
		btfsc	Status, Z
		goto	Start			;if start from beginning
		incf	count2, f		;else do next
		[COLOR="Red"]goto	Read22[/COLOR]

hi,
Just add the Read22 and the PORTB leds cycle thru OK.:)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top