Set these registers then check each bit flag after an interrupt movb #$FF,ATDDIEN0 ;Enable ATD channel as Digital input movb #$00,DDRADH ;make Port ADH i/p movw #$FFFF,PERADH ;Enable pullup movb #$00,PPSADH ;Interrupt on falling edge movb #$FF,PIEADH ;Enable interrupt TestATDHInt brset PIFADH,%00000001,Int8 brset PIFADH,%00000010,Int9 brset PIFADH,%00000100,Int10 brset PIFADH,%00001000,Int11 brset PIFADH,%00010000,Int12 brset PIFADH,%00100000,Int13 brset PIFADH,%01000000,Int14 brset PIFADH,%10000000,Int15 --- In , "Chris Knight" <knight@h...> wrote: > Silvo, > > I am currently working with the E128 and I had a similar problem. > > The I/O registers for Port AD are 16-bit registers and MUST be > accessed as such. You cannot access the high and low addresses > independently. I wish this was more clear in the documentation. > > In C, you should declare the register as a pointer to unsigned > short int. For example: > > #define ioPortAD (*(volatile unsigned short int *)(ADDRESS)) > > Hope this helps. > > Chris Knight > -----Original Message----- > From: silvozemljic [mailto:silvo.zemljic@h...] > Sent: Friday, May 14, 2004 5:26 AM > To: > Subject: [68HC12] Problems configuring PAD0..15 as input > Hello. > I'm using Adapt9S12E128 Microcontroller Module with MC9S12E128CPV > chip. > and Metrowerks Codewarrior development environment for HCS12 chips. > Here is my problem... > I would like to use PAD0..15 lines which are conected to onchip ATD > module as inputs, so that I can generate external interrupts on AD > port. > So I do following... > - set appropriate bits in ATDDIEN0 and ATDDIEN1 registers (ATD Input > Enable Registers) in ATD module to 1 (so I enable digital input on > those lines) > - if I understand ATD Block Guide correctly, ATD module is in power > off state at startup or reset, anyway, and I don't use ATD module at > this point > - next I set Port AD registers... appropriate bit in Data Direction > Register (DDARD) to 0 (configure it as input) and set all other > interrupt related registers > > So, in this configuration all the changes to signals on PAD0..15 > lines should reflect in Port Data Registers (PORTAD0 and PORTAD1) of > ATD module and > if I understand several Guides correctly also in Port AD I/O Register > (PTAD) and also in Port AD Input Register (PTIAD). > But when I change the level of the signals on PAD pins the change is > only reflected in ATD module PORTAD0 and PORTAD1, but not in the AD > Port registers. > > I've studied all the appropriate guides, but cannot find my error. Am > I missing something here? Can anybody help me? I woul really > appreciate it, because > I'm out of ideas and I really started to like this huge world of > small microcontrollers. I would appreciate any kind of help. > > Thank you in advance for your effort and have a nice weekend. > > Silvo Zemljic |