PORTAD as GPIO at 9S12NE64

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PORTAD as GPIO at 9S12NE64

6,525 Views
fmaesso
Contributor II
  Hi!
      I'm trying to program a keypad (4x4 matrix) with a 9S12NE64 using PORTAD. But when I define this port as input for my keypad, the CW return a error:
  L1907: Fixup overflow TI1_Interrupt, to _PORTAD1 type 1, at offset 0x5

#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void TI1_Interrupt(void){
unsigned char T;
  TFLG1 = 16;                         
  T = PORTAD1;
  key_scan(T);
}
...

If I change the PORTAD for PORTB (for example), no errors acours.

Labels (1)
0 Kudos
Reply
8 Replies

3,831 Views
fmaesso
Contributor II
HI!
  Now its OK. I replace the MC9S12NE64.* on the CW 3.1 path which come with CW 4.6 and now all works.

Thank very much for your help.

Fernando Maesso
0 Kudos
Reply

3,831 Views
fmaesso
Contributor II
Hello
Yes, the MC9S12NE64.h archive is declared in then main.c.
I tried to define with PORTAD, PORTAD1. In accordance with datasheet the address of this port is 0x8f. In the MC9S12NE64.h archive this address it is defined as PORTAD1.
  This error only appears when use the PORTAD. If use another PORT, does not have error.
The reason of the error is the use of ATD port? or I am defining the PORTAD of wrong way?

Thanks!

Fernando Maesso
0 Kudos
Reply

3,831 Views
CompilerGuru
NXP Employee
NXP Employee
With MC9S12NE64.h of HC12 V4.6, this works correctly, so I would guess that you use some other version, so which CW version do you use?
The actual error you see is generated if you include "MC9S12NE64.h" in your source file, but you do not have the corresponding MC9S12NE64.c added to your project, or more precisely if there is no matching definition for the variables declared in the header file. In that case I would expect a warning "default... created" before that error message.
Make sure you have the matching "MC9S12NE64.h/MC9S12NE64.c" and not a *.c file for another derivative. If in doubt create a new project with the wizard and check if it works in there. If not report the bug, if it does work, copy the settings :smileyhappy:.

BTW. In HC12 V4.6 the register is called PORTAD and not PORTAD0 as in your snippet.

Daniel

0 Kudos
Reply

3,831 Views
fmaesso
Contributor II
Hi
  The version of CW is 5.5.1272 . Come with the DEMO9s12NE64 KIT. If I posted the zip of my project, this help you?

Fernando Maesso
0 Kudos
Reply

3,831 Views
CrasyCat
Specialist III
Hello
To retrieve information on the CodeWarrior version you are using you need to:

  - Start CodeWarrior
  - Select Help -> About Freescale CodeWarrior
  - Click on "Install Products"
  - CodeWarrior version used is displayed on top in the Installed Products dialog.
 
IDE version number does not help at all.
Anyway it looks you are using an older release of the tools. I would recommend you to give it a try with V4.6. You can download a special edition from our web.
 
If you are still unable to get it working I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.

Attach the generated .zip file to the SR.
 
CrasyCat
0 Kudos
Reply

3,831 Views
Lundin
Senior Contributor IV
Ok my post was perhaps not very informative, but what I was saying between the lines is to make sure you are using the right variable name. PORTAD1 is located at 0x012F on all S12 derivates, a location labelled as "reserved" by the NE64 manual, simply because there is no secondary ADC on chip.

According to Freescale's NE64 manual this register is named PORTAD. It might also be PORTAD0, since that is the name of the register on all other S12 devices, like the D-family.

Check if this variable name exists in both the h and the c file. It might be quite possible that the wrong name "PORTAD1" exists in them, and in that case that would be the source of the problem.
0 Kudos
Reply

3,831 Views
CrasyCat
Specialist III
Hello
 
How did you define PORTAD?
Is it allocated in a user defined segment? Make sure to allocate the segment on the zeropage.
 
If you are using the header file delivered with CodeWarrior, make sure to add the corresponding .c file to your project as well.
 
CrasyCat
0 Kudos
Reply

3,831 Views
Lundin
Senior Contributor IV
I suspect that is the linker's way of telling you to only use peripherals that actually exist on the chip. I might be totally wrong but last time I checked, NE64 only had one ADC.
0 Kudos
Reply