hi i am used mc9so8dz60 demo board .. i initialize RTC timer .. but it is not working so please help me to int RTC timer..here is my code
void timerint(void);
void main(void)
{
EnableInterrupts;
timerint();
SOPT1=0x00;
{
PTFD_PTFD3=0;
PTFDD_PTFDD3=1;
Lcd16x2Init();
Cpu_Delay100US(1000);
DispMsg(msg,16,0x080);
Cpu_Delay100US(1000);
}
{ } /* loop forever */ /* please make sure that you never leave main */
}
void timerint(void)
{
RTCMOD=0;
RTCSC_RTCPS =15;
RTCSC_RTCLKS=0;
}
#pragma TRAP_PROCvoid RTC_ISR(void)
{
RTCSC=RTCSC|0x80;
PTCD_PTCD5=0; // led on
PTCDD_PTCDD5=1;
Cpu_Delay100US(100);
PTCD_PTCD5=1; // led off
PTCDD_PTCDD5=1;
Cpu_Delay100US(100);
}
Hello,
I see that your code does not set the RTIE bit within RTCSC. To avoid this type of problem, it is better to simultaneously write all bits when initialising a control register, i.e. RTCSC = 0x9F;
Some other comments about your code -
Regards,
Mac
thanks for your reply ...
but i still found the same problem i m no getting the RTC interrupt & i do changes that you suggest .. here is my code.. when i run the program..... program get hang & lcd doesnt show any thing...
but whn i remove EnableInterrupts then program run & lcd show the message but doesnt get the interrupt..
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#include "lcd16x2_4bit.h"
void timerint(void);
void RTC_ISR(void) ;
byte msg[]={"SPRY LOGIC LTD.."};
word counter=0;
void main(void)
{
SOPT1=0x00;
SOPT2=0x00;
timerint();
PTFD_PTFD3=0;
PTFDD_PTFDD3=1;
Lcd16x2Init();
EnableInterrupts;
for(;
{
Cpu_Delay100US(1000);
DispMsg(msg,16,0x080);
Cpu_Delay100US(1000);
}
for(;
{}
}
void timerint(void)
{
RTCMOD=0X00;
RTCSC=0x9F;
}
#pragma TRAP_PROC
void RTC_ISR(void)
{
RTCSC=RTCSC|0x80;
PTCD_PTCD5^=1;
PTCDD_PTCDD5=1;
}
Hello,
If your Lcd16x2Init() function relies on the use of interrupts, you will need to shift its position.
Regards,
Mac
hi my lcd int() function is doenot reli on interrupt.... but i still got the same problem
Is RTC vector pointing to RTC_ISR()? Did you set up RTC vector?
hi .. i think didnt ponit the vector ... but i dont how to point the vector can you please tell me how to point the vector of any interrupt using #pragma..
If you declare your function like this:
interrupt VectorNumber_Vrtc void RTC_ISRr(void) {
It will go into the vector table. I like this method, as if you have reuseable code you can just add it to the project, and it goes into the vector table.
The other option is to find the vector table in your project and put it in.
hi thank you ... for reply ..
but i have another problem regarding the port interrupt ... i use the PTA As an interrupt so i want to reconized the on which pin of PTA interrupt is coming .... so how to reconzie ...
Hello,
You will need to read the port input status from within the ISR, to determine the pin that caused the interrupt. This implies that the active level must be present for a period that exceeds the interrupt latency period, which may also include the period of other ISRs that are already executing when the the input event occurs.
If more than one input pin is enabled, and if a previously detected pin remains in an active state, input transitions from the other pins will not be detected. This applies even with the use of edge triggered mode for the interrupt, The solution is to temporarily disable each pin whilst it remains in an active state.
For mechanical switch use, a debounce period will also need to be allowed. An active pin would be temporarily disabled for a minimum period, usually within the range 10 to 100 milliseconds.
Regards,
Mac
Based on the tech ref and the block diagram, I don't think you can because the pins ar or'ed together to generate the interrupt and there does not seem to be a register holding the individual interupt states.
In other words, there is a single interrupt flip flop per port.
Also be aware that if you are using levels, you must make the level "go away" or you will keep getting interrupts if you leave that pin enabled for level interrupts. This effect will cause you code the seem crashed, as all it will be doing is servicing that interrupt.
Did the timer issue get resolved?
hello jim
Sorry for let but i am out of station for some day.. ya the timer isuue get resolved but i have aother issur regarding the how to use the temperature sensor in MC9S08DZ60.. i confuger sensor as oer data sheet but it didnt work properly.. so tel me hoe to use the temp sensor in application...