I am new to Freescale. I need a quick start.
I have gone through the PE and have the micro configured, but there is still a lot missing, so ...
Is there a library or a reference document that would help me with the basics of reading digital and analog inputs, writing digital and analog outputs.
Maybe a call like
digital_write(pinName, HIGH);
value = digital_read(pinName);
Is there anything like this available or will I need to write it all from scratch?
Surely, there is something out there that will make this easier.
Solved! Go to Solution.
When you create new project and make your setting in PE, you should click to menu-Processor Expert-Generate code “your project name”.
PE will generate IO_Map.c and IO_Map.h file in project\CODE directory.
File IO_Map.h contains definitions of all registers, vector numbers…
So, if you want for example set pin PA0 as output with high level, you can write:
DDRA = 0x01; //PA0 is output
PORTA = 0x01; //PA0 pin high
Or directly
DDRA_DDRA0 = 1; //PA0 is output
PORTA_PA0 = 1; //PA0 pin high
If you don’t use PE, similar file will be already implemented in new project tree - in "Includes". Name of this file will depends on your MCU. For example mc9s12p128.h
And this file you can find in CodeWarrior installation directory. Default path:
"c:\Program Files\Freescale\CWS12v5.1\lib\hc12c\include\"
When you create new project and make your setting in PE, you should click to menu-Processor Expert-Generate code “your project name”.
PE will generate IO_Map.c and IO_Map.h file in project\CODE directory.
File IO_Map.h contains definitions of all registers, vector numbers…
So, if you want for example set pin PA0 as output with high level, you can write:
DDRA = 0x01; //PA0 is output
PORTA = 0x01; //PA0 pin high
Or directly
DDRA_DDRA0 = 1; //PA0 is output
PORTA_PA0 = 1; //PA0 pin high
If you don’t use PE, similar file will be already implemented in new project tree - in "Includes". Name of this file will depends on your MCU. For example mc9s12p128.h
And this file you can find in CodeWarrior installation directory. Default path:
"c:\Program Files\Freescale\CWS12v5.1\lib\hc12c\include\"