Page 1 of 1

Introductory Articles

Posted: Tue Apr 01, 2008 8:02 am
by sry_not4sale
Can people post any links of good introductary articles about the cpu (or these style cpu's in general) and hardware and its capabilities. E.g. if I have never worked this intimately with microprocessors before, what should I read to get me up to speed?

Thanks in advance,
Aaron

Re: Introductory Articles

Posted: Tue Apr 01, 2008 10:31 am
by Fred
My current advice for lack of time to assemble some good knowledge is to do a grep of the source directory for http

cd src
grep -rn http .

and you will have plenty of good reading to do :-) If you give it a context of a few lines each side you should see what you are reading about too.

There are tonnes of good links for the hcs12(x)

http://www.s12x.com/

should probably link to some of them

I hope that helps :-)

Admin

Re: Introductory Articles

Posted: Wed Apr 02, 2008 8:52 pm
by sry_not4sale
Admin wrote:There are tonnes of good links for the hcs12(x)

http://www.s12x.com/
Could only really find links to books on there.

Can anyone recommend an introduction to embedded systems book aimed at the programmer?

Thanks in advance.

Re: Introductory Articles

Posted: Wed Apr 02, 2008 9:04 pm
by Fred
I'll try and assemble some links for you. It really is very easy to just do basic things. More complex things are only as tricky as the code that makes them up and the semantics of what you are trying to do.

If you grab the 0.0.1 version and up you will see that there is very little required to make the thing do basic stuff.

You literally just write to registers like this :

porta = 0xff; // turn all porta pins on

porta = 0x00; // turn all porta pins off

Additionally you can do it with an OR, XOR, or AND to just toggle particular pins.

Admin.

Re: Introductory Articles

Posted: Thu Apr 03, 2008 12:36 am
by sry_not4sale
Are the variable names you mention ( "porta" set up in init_io() ) preset in the compiler or do you need to assign them to the part of the hardware they control somehow?

From the code I gather they are preset?

Re: Introductory Articles

Posted: Thu Apr 03, 2008 12:47 am
by Fred
From the processor header, 9s12xdp512.h :

Code: Select all

/* shortcuts to speed formatting */ 
/* www.atmel.com/dyn/resources/prod_documents/avr_3_04.pdf First page, second column */
/* http://www.ee.nmt.edu/~rison/ee308_spr06/homepage.html */
/* extra parentheses for clarity and guarantee of precedence */

/* Dereferenced Volatile Unsigned Char Pointer */
#define DVUCP(address) (*((volatile unsigned char*)(address)))
and for example :

Code: Select all

/* Port Integration Module - Reordered within sections for clarity */
/* PIM information from 5 tables the last of which is spread over three pages */

/* Plain ports output switch, input state registers */
#define PORTS_BA DVUSP(0x0001) /* Both A and B combined as a 16 bit register for ignition access */
#define PORTA DVUCP(0x0000)
#define PORTB DVUCP(0x0001)
#define PORTE DVUCP(0x0008)
#define PORTK DVUCP(0x0032)
/* #define PORTC DVUCP(0x0004) these pins are not bonded on the 112 pin package */
/* #define PORTD DVUCP(0x0005) these pins are not bonded on the 112 pin package */
They are shortcuts to make a pointer to a memory location from a literal memory location. I'm not 100% certain that this is the best way to use the hardware, but my code god has been busy (got himself a girl) and hasn't had time to tear my code apart and tell me how to do it properly.

When you write to say port B, your data gets stored in the memory location at the address in the header.

Does that make sense?

This the same for all the control registers etc. Pretty much anything you "actually do" happens by writing/reading a register like that.

Then it comes down to interrupts which should be fairly straight forward if you know what they are at all, and just general structure and logic and computations.

How was that?

I have to admit something : I SUCK at being a teacher. Typically I fail to see it how the student does and I go right over their head :-)

Hopefully by trying my best to be clear I've done OK.

Admin.

Re: Introductory Articles

Posted: Thu Apr 03, 2008 12:49 am
by sry_not4sale
Spot on, that was really my only question about the code. (Apart from some of the logic but that is me not understanding engine management completely...)

Now I just have to get up to speed on C's compiling/linking etc and the hardware itself...

Re: Introductory Articles

Posted: Thu Apr 03, 2008 12:50 am
by sry_not4sale
Should have done a quick search for there definitions... my bad haha

Re: Introductory Articles

Posted: Thu Apr 03, 2008 12:54 am
by Fred
sry_not4sale wrote:Apart from some of the logic but that is me not understanding engine management completely...
If you have any questions, fire away. Most of what is in there is clearly discussed in various threads though. I can link you if your question is about that sort of thing. The interrupt semantics and timer semantics are the main stuff that might be non obvious. Draw a circle on your desk, consider each half of it one revolution of the engine, then think about what the state of the timer etc are when you go past the trigger tooth, and how that relates to the other events etc.

If something isn't clear by the comments and variable names, I need to do better. Point it out.

Admin.