Maker Pro
Maker Pro

Pickit 2 - won't write.

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Take out the returns after the calls to Delay. A return is used at the end of the function that you call. In this case a retlw.

Bob
 

max_torch

Feb 9, 2014
111
Joined
Feb 9, 2014
Messages
111
The 'Delay:' that you have placed inside the cblock is unnecessary. cblock is used to give aliases to registers. Labels such as 'Loop' and 'Delay' in your code are not registers and thus need not be defined.

The 'end' in the middle of the code should be removed. When you quickbuild the program, the code below the first end is being completely ignored because of this. You should only have one instance of 'end' and it should be at the bottom of everything.

You could follow an indentation standard to make things neater. Generally, my standard is to have only labels in the first column, commands and directives are all aligned in the second column, the objects of the directives are aligned in the third column, and lastly the comments are all aligned in the fourth. You make use of the tab key to automatically align these things.

There is no need to use retlw rather than just return at the end of the delay subroutine, since when you go back to the main subroutine it is there where you have specified what value to put in working register.

You don't need to have a return for each call. For now, basically you just need to make sure that each time a call is made it eventually executes a return before you do another call. The purpose of the stack is when you want to have 'nested calls' with a max of 7 or 8 nested calls.

The nops in the main loop are not necessary, they don't really contribute and are only adding clutter.
 

Devnode

Jul 13, 2015
94
Joined
Jul 13, 2015
Messages
94
Okay
The 'Delay:' that you have placed inside the cblock is unnecessary. cblock is used to give aliases to registers. Labels such as 'Loop' and 'Delay' in your code are not registers and thus need not be defined.

The 'end' in the middle of the code should be removed. When you quickbuild the program, the code below the first end is being completely ignored because of this. You should only have one instance of 'end' and it should be at the bottom of everything.

You could follow an indentation standard to make things neater. Generally, my standard is to have only labels in the first column, commands and directives are all aligned in the second column, the objects of the directives are aligned in the third column, and lastly the comments are all aligned in the fourth. You make use of the tab key to automatically align these things.

There is no need to use retlw rather than just return at the end of the delay subroutine, since when you go back to the main subroutine it is there where you have specified what value to put in working register.

You don't need to have a return for each call. For now, basically you just need to make sure that each time a call is made it eventually executes a return before you do another call. The purpose of the stack is when you want to have 'nested calls' with a max of 7 or 8 nested calls.

The nops in the main loop are not necessary, they don't really contribute and are only adding clutter.
Okay. I'll do that. Thankyou, guys.
 

Devnode

Jul 13, 2015
94
Joined
Jul 13, 2015
Messages
94
The 'Delay:' that you have placed inside the cblock is unnecessary. cblock is used to give aliases to registers. Labels such as 'Loop' and 'Delay' in your code are not registers and thus need not be defined.

The 'end' in the middle of the code should be removed. When you quickbuild the program, the code below the first end is being completely ignored because of this. You should only have one instance of 'end' and it should be at the bottom of everything.

You could follow an indentation standard to make things neater. Generally, my standard is to have only labels in the first column, commands and directives are all aligned in the second column, the objects of the directives are aligned in the third column, and lastly the comments are all aligned in the fourth. You make use of the tab key to automatically align these things.

There is no need to use retlw rather than just return at the end of the delay subroutine, since when you go back to the main subroutine it is there where you have specified what value to put in working register.

You don't need to have a return for each call. For now, basically you just need to make sure that each time a call is made it eventually executes a return before you do another call. The purpose of the stack is when you want to have 'nested calls' with a max of 7 or 8 nested calls.

The nops in the main loop are not necessary, they don't really contribute and are only adding clutter.
Max. I did as you adviced and the code simulated just fine with no error messages. The Pickit seems to be my problem because it does the exact same thing as last time. Shows programming is successfull when the memory shows blank. The 16F626 is a brand new chip. I'll start looking for another programmer i think. Caio.
 

max_torch

Feb 9, 2014
111
Joined
Feb 9, 2014
Messages
111
Max. I did as you adviced and the code simulated just fine with no error messages. The Pickit seems to be my problem because it does the exact same thing as last time. Shows programming is successfull when the memory shows blank. The 16F626 is a brand new chip. I'll start looking for another programmer i think. Caio.
Have you tried it with the __CONFIG directive placed in code? if that still didnt work, id say check hardware. Make sure the PIC isnt upside down when placed in the socket. Also sometimes the crystal oscillator is defective and needs to be replaced
 

Devnode

Jul 13, 2015
94
Joined
Jul 13, 2015
Messages
94
Have you tried it with the __CONFIG directive placed in code? if that still didnt work, id say check hardware. Make sure the PIC isnt upside down when placed in the socket. Also sometimes the crystal oscillator is defective and needs to be replaced
Max. I tried the __CONFIG direvtive in my code and it builds okay, the PIC is inserted the right way, im using a breadboard, and im not using an ext osc. The programmer recognizes it. Im now at my witts end. I think ill get a new pickit and focus om my Picaxe in the meantime while i wait for it. Can learn some basic so long. Thanks for all you guys have done so far. Caio.
 

max_torch

Feb 9, 2014
111
Joined
Feb 9, 2014
Messages
111
Try getting a new PIC as well, it could be a defective IC, the PIC is quite sensitive. And maybe you can try doing it with an external crystal oscillator first before using the internal oscillator. And try tomake just a single LED blink before doing several.
 
Last edited:

Devnode

Jul 13, 2015
94
Joined
Jul 13, 2015
Messages
94
Try getting a new PIC as well, it could be a defective IC, the PIC is quite sensitive. And maybe you can try doing it with an external crystal oscillator first before using the internal oscillator. And try tomake just a single LED blink before doing several.
I have ordered some 16F648 PICs, Max. Should be here in about a week. Its a pity though, i was just making some progress. You guys are great. We'll talk again sometime next week. God bless.
 
Top