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.

Nigel's PIC tutorials

Status
Not open for further replies.

Wond3rboy

Member
Hi, I want to know whether i can perform Nigels tutorials using the 16F628A and the 16F877a since the other 16F876 is not available here. I read in another post that codes for same core devices can be compiled for each other by changing initialization. Can i do it for the tutorials using 16F876?

Secondly i will LVP my 18F2550(arrived yesterday) and according to another post 'Unrecognized Junebug' i read that a person's LVP'd chip stopped working.Since i am flat broke right now and an 18F2550 costs like USD 15$ exluding S&H, i wont be ordering one any time soon. So can i LVP it again and make it work?
 
Hi, I want to know whether i can perform Nigels tutorials using the 16F628A and the 16F877a since the other 16F876 is not available here. I read in another post that codes for same core devices can be compiled for each other by changing initialization. Can i do it for the tutorials using 16F876?

You just have to change the name of the chip in the header, and alter the config fuse settings.
 
As far as I know you can LVP any suitable PIC at any time, as long as it's configured as LVP. If LVP has been turned off, you need an HVP to turn it back on.

There really seems little point in using LVP, and it's not something I've ever done or considered.
 
First I have never use Low Voltage Programming.

But as I understand it there should not be a problem. As long as LVP is not cleared by the programmer the chip can be reprogrammed many times.

"Secondly i will LVP my 18F2550(arrived yesterday) " I am not too sure what this means. Did you get a LVP programmer or a 18F2550 yesterday?
 
I got my PIC chip yesterday, I want to use the ART2003 Programmer to LVP it.Since i am going to need it again and again(in case of failure as written in that post) i wanted to make a permanent one. I wanted to ask whether one could LVP it once, when it 'breaks down' then LVP it again?
 
I got my PIC chip yesterday, I want to use the ART2003 Programmer to LVP it.Since i am going to need it again and again(in case of failure as written in that post) i wanted to make a permanent one. I wanted to ask whether one could LVP it once, when it 'breaks down' then LVP it again?

I do not know what you are talking about 'breaking down' or failure. It is as both Nigel and I said in our answers. As long as you do not turn off LVP in the config you can use LVP to program the chip.

Think of LVP as a switch. As long as you have it turned on in your config LVP works. Once it gets turned off (can only be done during programming) you can not use a LVP programmer. This should not happen.

But a non-LVP programmer can set it back.

Does that help ?
 
Hi ive got yet another problem! I couldnt find a mount on USB Male port so i cut a USb extension cable and plan to use it in my selfmade Junebug. The problem is that i cant tell which wire is for which signal, the four wire colors are Blue, Green, White and Pink.
 

Attachments

  • 29012009029.jpg
    29012009029.jpg
    331.4 KB · Views: 246
Code:
;Tutorial A1.1 - Sequential LEDs
	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.)

	cblock 	0x20 			;start of general purpose registers
		count1 			;used in delay routine
		counta 			;used in delay routine 
		countb 			;used in delay routine
	      [B]  increase [/B]               ;To make sequential LEDs
	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
             clrf   increase

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 waits for a while!
	incf    increase,w
	movwf	PORTA
	movwf	PORTB			;set all bits off
	call	Delay
	goto	Loop			;go back and do it again

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

Hi i have made these changes(jsut as experimentation) to have a binary counter sort of thing. What is wrong with this code?
 
Last edited:
Code:
;Tutorial A1.1 - Sequential LEDs
	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.)

	cblock 	0x20 			;start of general purpose registers
		count1 			;used in delay routine
		counta 			;used in delay routine 
		countb 			;used in delay routine
	        increase                ;To make sequential LEDs
	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
        clrf    increase

Loop	
	movf   increase,w
	movwf	PORTA			
	movwf	PORTB
	nop				;the nop's make up the time taken by the goto
	nop				;giving a square wave output
	call	Delay			;this waits for a while!
	call	Delay
	incf    increase,f
	goto	Loop			;go back and do it again

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

Hi i did what you said but it is still not getting compiled.MPLab just sort of gets stuck(not hanged) and in proteus i get DOS error and saying that .list file not found.This same thing happens if i change the portA to some spcific bit and not the whole port in your 1.2 tutorial.
 
Last edited:
Hi Nigel Sorry for late reply. As i said before, MPLab just gets stuck.Heres what i get:

Debug build of project `E:\PIC Tutorials\Assembly\tutorial1\TA1.1.disposable_mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Sun Mar 22 21:59:58 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628A "TA1.1.asm" /l"TA1.1.lst" /e"TA1.1.err" /d__DEBUG=1


Although i installed a fresh copy of the software.
 
I suggest you try again, and use a legal filename this time - you can't have multiple fullstops in it.

Personally, I would also advise against spaces in filenames as well - try and keep them to DOS standards.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top