PIC Assembly Language Tutorial: #1 – Config and Clock

This first PIC assembly language tutorial covers the configuration word (sometimes called the fuses) and clock sources of the PIC12F675.

Comments

Rob Bruno says:

Great info. Any plans to use MPLAB-X in the future? I am kind of a PIC novice but like some of the feature of the newer IDE / IPE.

James Searle says:

This might be a silly question, but isn’t FFFF all ones?
Is there a reason you used 3FFF instead?

john jones says:

With high level languages/development suites we are too often removed from the need to understand what it really going on behind the scenes. I appreciate your covering the low level, gritty basics such as config settings. I’m very much looking forward to the continuation of this series. Thanks!

Raymond Heath says:

I may have to buy one of the Ebay boards in order to duplicate these experiments as my home made board is not laid out the same and I cannot duplicate board capacitance in the RC capacitance experiment

Brian Durward says:

This a really interesting tutorial. Help if possible – when I try and write to the PIC I get the same output at 6:37 but without the Setting MCLR 3-State line. Not sure what I have missed or done wrong.

Rakesh Pai says:

Thanks for doing this. I must say I was skeptical at first (“what’s the point of learning PIC assembly!”) but you’re making it more interesting than I thought it could be.

Mark Hall says:

PIC tutorials not for me, and I don’t think you are so good at the tutorial type videos as the others you do e.g. post bag, kit builds, solar, where your personality and style work better

Oerjan Snell says:

Please let me/us know how to get/set the config for the internal osc.

Dan Pinko says:

(I hope I can post this here Julian)

I’m new at programming PICs and have looked forward to this tutorial. I tried to follow Julian’s tutorial as close as I could today but I can’t any of the “clocks” to run on the PIC.

I am using the PICKIT2 and the PIC12F675 Development Board modified as per Julian’s earlier video.

I am using the MPLAB version he recommends running on a WIN 10 PC. All seems to work as outlined and I get no error messages. The only different from what Julian shows on his video and what I get is when he programming the Target. I seem to be missing a line of text – all else is the same.

I am missing the second to last line showing “Setting MCLR 3-State”. It ends as his does with “PICkit 2 Ready”.

========His output file shows this========

Programming Target (11/02/2017 13:21:41)
PIC12F675 found (Rev 0xB)
Erasing Target
Programming Configuration Memory
Verifying Configuration Memory
Setting MCLR 3-State
PICkit 2 Ready

=================

========Here is a copy of my output file showing the programming and verifying of the Target======

Programming Target (2/13/2017 5:53:59 PM)
PIC12F675 found (Rev 0xB)
Erasing Target
Programming Configuration Memory
Verifying Configuration Memory
PICkit 2 Ready

Verifying Target
PIC12F675 found (Rev 0xB)
Verifying Program Memory (0x0 – 0x3FF)
Verifying EEPROM Memory (0x0 – 0x7F)
Verifying User ID Memory
Verifying Configuration Memory
PICkit 2 Ready

==================

I have checked all connections and retried a number of times programming from the beginning of the Video with no signal showing up on GP4 using either the external RC clock or the internal clock.

I am checking GP4 with a scope as well as a frequency counter (not the one he uses) with nothing showing on the GP4 pin.

I have tried Googling “Setting MCLR 3-State” with no results.

Anyone have any ideas how I can fix the problem or what I am doing wrong?

Mike Moniz says:

I ran into an issue where the clock would be very intermittently working (clock runs then drops to 0 at random times) in all the different clock types. Found that you may need to put IN the Reset/GP3 jumper during tests. I left it off during programming but didn’t think to put it back. I assume the chip might be randomly held reset because the pin was left floating?

SidneyCritic ComedyHound says:

You should find another chip to read the cal off just for kicks, actually my curiosity.

Themythgamer41 says:

finally found a channel of unboxing and invetions love it subscribed

james mayo says:

thank you so much for doing these videos Julian! As a mechanical engineering student that has had a good bit of success with arduinos in my free time I have always wanted to see how electrical engineers and embedded developers do that black magic that is machine code. Keep the PIC tutorials coming! I’m going to have to get on ebay here real soon and find a pickit and development board to follow along.

Terry Burns-Dyson says:

Enjoyed this intro, thank you. I’m a high level language guy, trying to learn more about electronics, but I followed along just fine. Just waiting on my stuff from Alice to be able to follow along fully.

0xDEADBEEF says:

If anyone is having issues with the Pickit 3 and getting “Failed to get Device Id.” try changing the voltage down to around 4v in the “Programmer->Settings->Power” menu. Took me hours of playing to get this working. No idea why it doesn’t like 5v. Both the Pickit 3 and dev board were purchased from Alice.

slap_my_hand says:

If microchip only had a good C compiler…..

MikeK8LH says:

Is there a chance the OSCCAL value is still in 12F675 flash memory at address 03FF? When the PIC12F675 comes out of reset it executes the instruction at 03FF (a “movlw xx” instruction which contains the factory calibration value) and then the program counter rolls over to 0000 where your first program instruction should be a “movwf OSCCAL” instruction.

The PICKIT2 “program” function is supposed to preserve that factory calibration instruction at location 03FF in program memory during programming.

Steve Malikoff says:

Hi Julien. Do you see any issue following along just using breadboard. I have programmed a pic this way using my pic kit 3 in the past.

E_404 says:

Hey Julian,
is there any schematic fir the Pic Board? I dont want to wait 4 weeks so i want to build one myself.

Ian Colquhoun says:

Link to that scope kit? Ebay usa if you have an affiliate….

Maurice Lalor says:

Hi Julian,
Is it possible to replace the PIC12F675 on the development board with say a PIC12F683? or any other 8 pin PIC

TheProCactus says:

Excellent pace to learn and think and learn.
If only it was for the ATMEGA’s.

Nicholas Barnes says:

I’ve been playing with Arduino for a long time and have been meaning to play with PICs for a while and ordered the bits and pieces from your last video straight away. They’re still on their way!
However, I think this video raises more questions than it answers. I understand about the RC clock. Seeing a crystal/resonator clock in action would have been useful (including what are the minimum/maximum values that work), but the thing which has me lost is the internal clock. You briefly explained that the correction factor is stored in the PIC and that all we had to do was read it. Some more information on this would be helpful – why do we have to read it and do we have to read (and write?) it every time we reprogram the PIC? If so, how? I understand that the clock time is the speed instructions are executed in, but what does this mean in PIC terms – i.e. what are the pros and cons of using different clock speeds (and, indeed, what are the pros and cons of using RC/crystal/resonator/internal clocks?).
Keep up the good work!

alphahr says:

for internal oscillator chips I read it first and then write the value on a piece of tape and stick it on the chip in case I accidentally blow it away programming

Colin Pamplin says:

Good start to the tutorial series thanks for posting.
For those using PICkit3 programmers to switch on Power Target circuit – click on > Programmer > Settings > Power and check the box. Hope this helps

Levi Schuck says:

The pencil cursor got me laughing. I always wondered if you accidentally poked your screen with them from time to time.

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!