PIC Assembler Observation

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Bebe

That will probably be useful later.

Breaktime here and then back to the saltmine reading tutorial.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Max

I looked at Goodwin tutorial a couple times.

These tutorials are about 20 lessons assembler 15 pages per lesson.

C lessons about the same.

I think there are more. Will look into that.

So minimum 600 pages of lessons here.

I think combined it may cover 90% of what you can do with a PIC.

Think it leaves out the adding features together type programs. Complex programs.

That you have to put supplied pieces together yourself.

Like a data logging program.
 

joeyd999

Joined Jun 6, 2011
6,337
So minimum 600 pages of lessons here.

I think combined it may cover 90% of what you can do with a PIC.
Not even close. I'd estimate that there are probably 10 to 100x more atypical embedded processor applications than typical. Things that couldn't be covered in 6,000 pages, much less 600.

Even then, typical approaches to most (typical) problems tend not to be optimal (or even adequate) solutions once they are combined into a system.

It's OK to learn through example. Just be ready to have to invent a new approach when the situation calls for it.
 

Papabravo

Joined Feb 24, 2006
22,084
You can fish or you can cut bait. I learned assembly language programming for a machine that preceded the microprocessor by more than a decade. By the time PICs came along the only new new thing was the peripherals in hardware like Timers, UARTS, CCP, and NCOs. We never had no steenkin' tutorials so by the time they came along they were largely useless. Been fishin' for a long time y'all.
 

TQFP44

Joined Sep 3, 2016
51
So you filled your grey matter with the 35 PIC instructions, that's like you know the alphabet, but now you need to put some sentences together, then a page , then a chapter then a book.... make it your book . Perhaps like Papabravo.. I put machine code (hex) into a mpu memory chip(s) via a switch pack and a button in the 1980's , very rewarding when the LED actually came on ! You don't say you have put some code down, I would encourage you to get stuck in, ( ; comment everything ) you have probably realised there is a lot more to embedded than just the code... like timing and protocols etc etc.... the data sheet will be your teacher .
 

Papabravo

Joined Feb 24, 2006
22,084
I will also add that Microchip, aka General Instrument, went from being a third tier player to to an industry powerhouse in a very short period of time. They arguably produce some of the best datasheets in the industry. I am especially fond of their diagrams illustrating how a single pin can have multiple functions. If I was a pure programmer, without any knowledge of circuit design, I doubt those diagrams would have the effect that they did.

It's time to fish.
 

OBW0549

Joined Mar 2, 2015
3,565
You can pick up the Datasheet or these tutorials.
You may as well get used to referring to data sheets, and understanding the information in them; tutorials are only useful in the beginning, for getting started.

Unless you are working exclusively with one or two of the very simplest PICs, and doing so every day, and have been doing so for a long time, you will never be able to memorize all of the information you need to do your programming, and will need to refer to the data sheet more or less frequently. Get used to it.

Think it leaves out the adding features together type programs. Complex programs. That you have to put supplied pieces together yourself. Like a data logging program.
That's a lot like describing walking and chewing gum at the same time as being a "complex" activity.

What makes a program complex is the intricacy of the program's underlying logic, not the number of PIC peripherals it makes use of. Those merely make for more details-- and more times you'll need to refer to the data sheet.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Papabravo OBW Max and TQFP44

Have to keep heading in one direction here.

Tutorial has moved 'up' to 12F509 and16F506.

He made mention of 16F505 but just went to 506 for more memory or an added peripheral.

There are 6 'Chapters' of tutorials.

For Baseline Midrange and Enhanced midrange. Assembler and C for both.

10 plus lessons per chapter. About 15 pages plus for each lesson.

So 900 pages plus. Total.

Let me get back to reading.:)
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Yes. I see the need to do some examples here.

Still working on getting programming to be consistent.

Thinking over the simulator and debugging thing.

I think their is a catch to debugging Baselines.

Need to get a header board or something.
 

JohnInTX

Joined Jun 26, 2012
4,787
The baseline and other dinky PICs do not have resident debugging hardware. To use a PICkit or other debugger requires a header board. These boards contain a bigger PIC with specialized hardware to service the PK or ICD and replicate the pins of the original chip so that you can plug the header into your breadboard and make it look like the target part to the rest of the circuit while having some debug capability.

Bigger, later PICs have resident debug hardware with varying degrees of breakpoints, trace etc. The -ME2 headers for the 16F1xxx Enhanced Midrange stuff cost peanuts and give emulation capability rivaling a multi thousand dollar ICE. Which is why I would start there instead of the '509 and other baseline stuff.

My .02
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you John

'-ME2 headers for the 16F1xxx Enhanced Midrange stuff cost peanuts and give emulation capability rivaling a multi thousand dollar ICE.'

Will file that away as side project.

Low Pin Count board bonus buy came with a couple 16F1xxx's.

So with Baselines I can program the PIC with a value in a register and

read it in IPE and that's it?
 

be80be

Joined Jul 5, 2008
2,395
There really no reason to even think about debugging a baseline chip. Use the sim it works and shows whats going on really good.
And you still learn the same tools to hammer on when you move up to chips that can use a pickit3 to debug.
I wrote the code for serial bit bang on a baseline chip in 2008 I didn't no nothing about pic chips all I new was a basicstamp had one on it and
the dang thing cost me $40 to get one sent to my door.
I posted on a electro-tech-online how to start with the pic and someone posted you can get chips for free I did and some I couldn't even solder the where small smt chips. I waited for the chips to come and dang what am I going to do the pickit2 came from microchip with a buggie 16f690
I played with that while the p-dip chips came to the door and even made a board form the smt chip which I messed up because It was 3.3 volt chip I got see it blink a led for about minute then up in smoke.
So I'm reading datasheets and help files that mplab has I post my first bit bang code And Mike points out the timing is off it's 3 cycles off
I open up the sim it took maybe 2 days to figure out how to get it to time data out. He was dead on the timing was off a bit but it worked.
He posted my code with some timing changes it was off the same as mine 3 cycles both work.
Sim is a good tool mplab-x I don't really like how sim works with it but It works so I use it.
I love Linux and I moved over to windows because of the pic ide But now that Mplab-x works on Linux I back to using it.
But now I'm playing with xc8 boy thats a new game to play. It works but you have to dig in and learn it.
I spent a hour writing code that looked right but would not compile.
Code:
#define ledA_Toggle()             do { PORTCbits.RC0 = ~ PORTCbits.RC0; } while(0) //this works
// this don't and I seen it work but I'm learning
#define ledA_Toggle()     PORTCbits.RC0        do { PORTCbits.RC0 = ~ PORTCbits.RC0; } while(0)
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Burt

That was kind of the question I was asking.

I think after studying these tutorials.

You still end up 'Looking it up as you go'.

I guess the idea is this way I will have a better idea WHERE to look.

In my 'Tutorial Toolbox' and the datasheet of course.
 

TQFP44

Joined Sep 3, 2016
51
Like I typed... walk before you run... I didn't go De-bug till Pkit3 and PIC24 , SIM was all i needed and simple LED as has been said , a logic tool is useful , Pickit2 has one , or Bus Pirate ....
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you TQFP

Okay. Got it. Use the Sim later.

That's 3 or 4 people that have said 'Use the Sim'.

I will take a look at it. Just to get the idea.

See how much a 10F200 header will cost me too.
 
Top