Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

UART in DSPIC30F4011 using XT with PLL 8x

Status
Not open for further replies.

variaseng

New Member
Hi! I am trying to work with dspic30f4011 UART capability. When the setting was in XT only, the UART was working. But when I edited it to XT with PLL 8x, no output came out from UART terminal.
Code:
void main() {
  TRISB = 0xFFFE;
  ADPCFG = 0xFFFF;

  UART1_Init_Advanced(9600,_UART_8BIT_NOPARITY,_UART_ONE_STOPBIT);
  UART1_Write_Text("Hello");
  Delay_ms(100);
}

My code is the one above. I have no idea what to change. I tried to change Baud rate from 9600 to 19200 but does not work. The settings are the following:
**broken link removed**

I'm using mikroC here. The settings for oscillator can be edited through the Edit Project option in mikroC (see photobucket image above).

Thank you in advance! :)
 
I don't have any experience with the mikroC environment and its libraries but I'm guessing that you need to fix the Oscillator Frequency field in your edit project window. The UART1_Init_Advanced() function has to make use of this value since you are telling the function what baud rate you want instead of telling it what your BRG (baud rate generator) register should be set to.

Change your Oscillator Frequency field to 8 times your crystal frequency and see what happens.
 
Oh so for example, my oscillator frequency(external clock) is 7.37Mhz, I only need to change this o 7.37*4? Ok. I will try this and update for the results. Thank you very much!
 
You need to multiply by *8 not *4 so use 58960000 and see how it ends up. You should inspect the code that is being generated to confirm that the compiler is working in this manner.
 
Last edited:
[SOLVED] UART in DSPIC30F4011 using XT with PLL 8x

Thank you very much for your reply! The UART is already working, multiplying the oscillator frequency by PLL x solved it. :) Thanks!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top