Ruth Hendrix

MC9S12NE64 - Questions, Help

Discussion created by Ruth Hendrix Employee on Jan 26, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
Posted: Wed Mar 09, 2005 2:44 am    
I am currently involved in a solo project for myself to create a device which can essentially store data and spit it back out.

In more detail:

I am making a device to interface with my programmable ECU on my car.

What my device will essentially do is, it will accept fuel map data from the software supplied with my ECU and store it. It should be able to store 4 different maps in the flash memory.

Once this is done, I want to be able to hook up the unit to my car and press a button to have the selected map loaded onto my ECU.

Essentially it is a quick map switching unit so that I dont need to use my laptop whenever I want to change settings.

There will be three modes

Programming mode, where the 1st com port will accept data to a specified memory bank

Write mode, where the device is ready to write data out to the ECU

and Passthrough Mode, where the device passes all communication from the first serial port to the second one.

I also want to implement an LCD to show status, current map loaded, etc.

I am a bit lost on how to do this with the HCS12, as my knowledge is limited. I have only had a few courses on the matter, and I am getting frustrated.

Can anyone help me get on my way, or point me toward some links that might be helpful.

The first thing I have tried to do is to get the LCD to work, which is on the SPI interface. I have had no luck.

Thanks in advance.
Posted: Wed Mar 09, 2005 2:41 pm    
Have you thought about using one of those Hitachi controlled LCDs? They are like the Defacto standard in small LCD screen controls. check out for cheap screens.
Posted: Wed Mar 09, 2005 4:49 pm  
Have you looked at the PSOC from cypress microsystems? There little dev board ($65) with an external serial e squared (+$cheap) is like all you need to develop it. They are also very easy to write in C (the compiler is only like $150! and you can do whatever u want with it) and are pretty much like drag and drop to setup what you want to do. Ex. I want to have an LCD put it on these set of pins. I want to have an EEPROM on these pins. I want to do SCI on these pins. and code like...
StartLCD(); LocateLCD(0,0); PrintString("Hello World"); 

doesnt get much easier. If you want to stick HCS12 I totally support you, it's just that for some people if learning the HCS12 is difficult it might be better to look at something else for your first few projects.
Posted: Wed Apr 20, 2005 5:58 pm    
I have about given up on the LCD for now, mostly because Axiom has told me that the LCD they sent me has known issues and it probably wont work.

I have two other questions now though.

1) How do I write data (coming in from serial port) to the flash memory for later use.

2) How do make a program I write run on startup of the board, so that when I am finished, I can unhook the board and every time I turn it on, it runs my software.

This model is highly undocumented, does anyone knw of any good resources for me to look at for code examples?
Posted: Fri Apr 22, 2005 8:14 am    

1) The Flash memory programming works as a state-machine. The Flash user guide will tell you how to set-up registers and how to store DATA.

2) The RESET vector is the vector which if fetched when you power-up your board. You need to write the start-up address of your program at its location for your program to be run at each Reset.

If you are using CodeWarrior from Metrowerks, you can see .PRM or "parameter files". These include description of the memory blocks (where is the Flash, the RAM...) and also indicates interrupt vectors.
If you associate your main() with a certain vector, main() will be called when the associated interrupt occurs.
When you're using CodeWarrior, it is creating start-up code on its own to initialize variables (among other things) and it also automatically calls main() at the end of the initialization.

Posted: Fri Apr 22, 2005 10:42 pm    
I have had a few courses dealing with the HC12 but the ones I was taught on didnt have a serial monitor and we used the console for I/O during debugging, since this board uses code warrior, im pretty lost.

I dont know if I have the needed skills to complete this project.

I certainly dont have enough reference...the manual that came with the board is about 6 pages long. I need a book for this thing.

Can you recommend a good book deading with this hardware, or maybe code warrior, otherwise im pretty screwed. This project needs to come together in about 4 weeks. Its pretty simple and straightforward but im having trouble completing even the most simplistic tasks.

Any help anyone can offer me would be greatly appreciated.