- This topic has 2 replies, 2 voices, and was last updated 10 years, 10 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
|
Microcontroller › PIC › 18F4431 USART MPALB X Logic Analyzer don’t work
Hi everybody,
I try PIC18F4431 to transmit a character with usart module on MPLAB X V2.05 simulator, but the logic analyzer of MPLAB remain flat.
Why? I don’t understand, the code is simple. Bug on the simulator?
This is the code:
<code>
#include <xc.h>
//******************************************
//MAIN
//******************************************
int main(int argc, char** argv) {
int word=0b10101010;
PWMCON0bits.PWMEN2=0; //PWM of on portB
PWMCON0bits.PWMEN1=0;
PWMCON0bits.PWMEN0=0;
SSPCONbits.SSPEN=0; //SSP off
ADCON0bits.ADON = 0; //disable ADC module
ANSEL0 = 0x00; //disable A/D input
INTCONbits.GIE = 0; //disable interrupt
TRISCbits.RC6 = 0; //usart out pin
TRISCbits.RC7 = 0; //usart out pin
TXSTA=0; //reset register
RCSTA=0; //reset register
BAUDCON=0; //reset register
TXSTAbits.CSRC=1; //clock from BRG
TXSTAbits.TX9=0; //8 bit
TXSTAbits.SYNC=1; //syncro
TXSTAbits.BRGH=1; //high speed
SPBRGH=0; //baud rate
SPBRG=16;
RCSTAbits.SPEN=1; //serial port enable bit
TXSTAbits.TXEN=1; //enable TX
TXREG=word; //transmit
while(1);
return 0;
} </code>
Hi,
Keep the code excluding the register settings inside the while (1) loop and try again.
No, the logic analyzer of MPLAB don’t simulate USART peripheral. I asked it on microchip forum.