Is there an IO library and documentation for MC9S12 products?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Is there an IO library and documentation for MC9S12 products?

跳至解决方案
1,119 次查看
checkers
Contributor III

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.

标签 (1)
0 项奖励
回复
1 解答
964 次查看
RadekS
NXP Employee
NXP Employee

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\"


在原帖中查看解决方案

0 项奖励
回复
1 回复
965 次查看
RadekS
NXP Employee
NXP Employee

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\"


0 项奖励
回复