pic programming.................. what next?

Status
Not open for further replies.
yeh thanks atferrari, i did that last night, and it did make it much clearer, but can anyone answer my previous post

does each goto take two instruction cycles because of the whole wrong number in the PC and the flushing out thing?
 

No idea, and why does it matter? (unless you're a chip designer at MicroChip), a GOTO takes two instruction cycles, and is clearly specified as such in the datasheet.
 
tama182 said:
does each goto take two instruction cycles because of the whole wrong number in the PC and the flushing out thing?

You should download and read the 16F628 datasheet from Microchip. Section 15 describes what all the instructions do and explains that any instruction that changes PCL will take 2 cycles. So call, return, goto, btfss and a few others do/can take 2 cycles - the btfss type only take 2 if they skip.

Mike.
 
The full datasheet explains why GOTO will always take two cycles.

Yes, it is the flushing of a prefetched instruction.
 
No idea, and why does it matter? (unless you're a chip designer at MicroChip), a GOTO takes two instruction cycles, and is clearly specified as such in the datasheet.

ok ok ok.............why you given me such a hard time, all these replys you give me are aimed towards more than a noob,

im trying to understand your tutorials, and i want to understand how every line works, and at no point does it explain that a goto takes two instructions !!!!

thanks for telling me to look in the pdf and i will, but whats with all the bitchyness LOL 8) , :wink: ,

gimme a break !!
 
tama182 said:
thanks for telling me to look in the pdf and i will, but whats with all the bitchyness LOL 8) , :wink: ,

gimme a break !!

As you can perhaps imagine?, we get LOT'S of questions, a great many simply because the poster hasn't bothered to read the datasheet. This should ALWAYS be the first thing you do.
 
when using mplab 7.3, is it possible to view the program counter, like you would watch all the regisiters etc under the watch tool, i can see PCL, but not PC
 
Nigel, i am following your guide aswell as my book, but the pic i got was a 628a rather than a 628, is there anything i should watch out for?
 
tama182 said:
when using mplab 7.3, is it possible to view the program counter, like you would watch all the regisiters etc under the watch tool, i can see PCL, but not PC

If your using MPLAB SIM then the PC is at the bottom of the screen.

Mike.
 
OK, WHY DO I ALWAYS GET PROBLEMS !!!!!

well as you know, Nigels tutorials are written for the 628, im using a 628a which ive checked will program and debug on my icd2,

im on tutorial 1.6 at the moment, the bouncing LED, when i program it, it works fine, but for some reason im not able to debug it,

i quickbuild first,

then when going to debug mode i get

ICDWarn0020: Invalid target device id (expected=0x83, read=0x83)

so anyway i click ok and then program, where i get this in the output box






so then i try to run it and i get

ICDWarn0015: Program memory has changed since last program operation? Continue with Debug operation?

so i click ok, then i get this in the output box



i dont get it, ive made sure that the device is set to 628A in both the code and the select device.... tab

but even though it does program and work, i do get this

ICDWarn0033: MPLAB ICD 2 does not support programming this device if both the internal oscillator and internal MCLR are selected. You may continue programming, but you are encouraged to cancel, reconfigure your device, and try again.

but even though i click ok it still works,

any ideas why this would be happening?
 
I dont know if this helps but often my simulator finds errors in my code that works perfectly fine on the chip.
Usually it is to do with conflicting setup code.



Also dont have a go at Nigel, many people of his expertees dont waste their time helping newbies.
If you post a question about something relatively complex, then expect a complex answer.
 
well its just that all of the tutorials wont debugg, i think it has somthing to do with the configuration mode that is being used, i mean the 628 doesn't debugg with the icd2, just the 628a, and i have made sure to change that at the beginning of the code,

all the tutorials have __config 0x3D18

and i think that the debugg wont work with it, is there anyone who knows if i am right?

to be honest i dont even know where that number comes from because the pic 16f628.inc has this

_BODEN_ON EQU H'3FFF'
_BODEN_OFF EQU H'3FBF'
_CP_ALL EQU H'03FF'
_CP_75 EQU H'17FF'
_CP_50 EQU H'2BFF'
_CP_OFF EQU H'3FFF'
_DATA_CP_ON EQU H'3EFF'
_DATA_CP_OFF EQU H'3FFF'
_PWRTE_OFF EQU H'3FFF'
_PWRTE_ON EQU H'3FF7'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_LVP_ON EQU H'3FFF'
_LVP_OFF EQU H'3F7F'
_MCLRE_ON EQU H'3FFF'
_MCLRE_OFF EQU H'3FDF'
_ER_OSC_CLKOUT EQU H'3FFF'
_ER_OSC_NOCLKOUT EQU H'3FFE'
_INTRC_OSC_CLKOUT EQU H'3FFD'
_INTRC_OSC_NOCLKOUT EQU H'3FFC'
_EXTCLK_OSC EQU H'3FEF'
_LP_OSC EQU H'3FEC'
_XT_OSC EQU H'3FED'
_HS_OSC EQU H'3FEE'


anyonw want to explain where __config 0x3D18
comes from please :lol:
 

The value 0x3D18 is for the config word in the 16F628 for the options required for my tutorials - you can 'AND' the equates above to generate a similar value. However, I suggest comparing the 628 and 628A datasheets to see what you actually need, as there are differences in the config word between the two.
 
tama182 said:
do you think that the configuration type could be the problem why i cant get your tutorials to debug

Quite possibly?, check the 628A datasheet and set the config word accordingly.

However, there's no 'debug' setting in the config word (as there is in some PIC's) - but the config still needs altering for the 628A.
 
what do you mean set it accordingly, remember im a noob i have no idea what all the different configurations do, im still learning the code,
 
tama182 said:
what do you mean set it accordingly, remember im a noob i have no idea what all the different configurations do, im still learning the code,

Use 0x2118 for the config word, that's the same settings as for the 628, don't know if it will help debugging?, like I said there's no options for that.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…