Hi everybody, I am learning to program with MCUs and now i have got the SK-XC164 board.I am trying to transmit via ASC0 a message. This message has 6 equal bytes and I must do it with transmit interrupt. Has anyone a simple program to practise??. The message I would like to see the message through Hyperterminal on PC. Thanks to everyone.
I am exasperated :( . I tried to do the same program that Chis did, but this time using ASC1, and it doesn't work. Probably i have wrong the initialization of ASC1. Can you help me Chris? Thank you very much
I hope you are using the right vector to handle your communication? that would be required if you changed to ASC1.
How do I know if I am using the right handle? The ASC0 and ASC1 are supossed to be equal, aren't they? Thanks for reply.
well, look in your data sheet. I assume each of these peripherals has its own interrupt vector. you need to change the number of your interrupt service routine to handle ASC1 rather than ASC0.
There is a difference in what the pins share for the ASC1 concerning other features on the device. For example if you are debugging with JTAG then you have a problem since the JTAG pins are shared with the ASC1 port. So you cannot do both at the same time.
So here are the pins... P3.1/T6OUT/RxD1/TCK P3.5/T4IN/TxD1/BRKOUT
Keil doesn't use the BRKOUT feature so the TxD1 is ok to use for transmitting. However, you have a problem on the receive pin, TCK (JTAG Clock) being shared with the RxD1.
-Chris
For Tamir: I have different vector for my interrupt service routine. Look this:
#define ASC0_TINT 0x2A #define ASC0_RINT 0x2B #define ASC0_TBINT 0x47 #define ASC1_TBINT 0x5E #define ASC1_RINT 0x49 void ASC1_viRx(void) interrupt ASC1_RINT using RB_LEVEL15 { ... }
For Chris: I have already taken that into account. At this moment, I'm not using JTAG, therefore this Rx pin is free. Its my opinion :( Thanks.
did you make sure your ISRs have distinct priorities (group/level, if it is indeed the same as on a C166...)?
ASC1_CON = 0x0011; // load ASC1 control register ASC1_BG = 0x0011; // load ASC1 baud rate time reload register ASC1_TXFCON = 0x0100; // load ASC1 transmit FIFO control register ASC1_RXFCON = 0x0100; // load ASC1 receive FIFO control register ALTSEL0P3 |= 0x0020; // select alternate output function P3 |= 0x0020; //set data register DP3 |= 0x0020; //set direction register /// ----------------------------------------------------------------------- /// Configuration of the used ASC1 Interrupts: /// ----------------------------------------------------------------------- /// TxBuffer service request node configuration: /// - TxBuffer interrupt priority level (ILVL) = 14 /// - TxBuffer interrupt group level (GLVL) = 1 /// - TxBuffer group priority extension (GPX) = 0 ASC1_TBIC = 0x0079; /// Rx service request node configuration: /// - Rx interrupt priority level (ILVL) = 15 /// - Rx interrupt group level (GLVL) = 1 /// - Rx group priority extension (GPX) = 0 ASC1_RIC = 0x007D; ASC1_CON |= 0x8000; // enable baud rate generator
Finally, the mistake was that the wire wasn't well connected. The program runs correctly. Thanks for your helps