Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USART Transmitter switching clocks

Status
Not open for further replies.

M3GAPL3X

Junior Member level 3
Joined
Jul 29, 2009
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,521
usart 8mhz

Hi guys,

I am currently using a LFINTOS (Low Frequency Internal Oscillator) set at 31 kHz as my main clock source. Eventually in my program, I will be needed to transmit some data through USART. From what I have been reading, I might not be able to use 31 kHz to achieve this - mostly due to baud rate generation. Is there a way I can switch clocks when I want to transmit data and go back to 31 kHz?

Any hints or guidance would be appreciated.
 

uart sleep pic

I will be using a PIC18F14K50 with a baud rate of 115.2k

Thanks
 

transmit enabled usart microcontroller

Thanks blue. My question is that will I have it disable the LFINTOSC (31 kHz) which is mainly for my watchdog timer before enabling the higher 8 Mhz clock or will it switch off automatically?

Thanks!
 

uart transmitter baud generator

Thanks blue. In my USART routine, I just enable the 8 Mhz HFINTOSC for baud rate generation.
 

clock usart

Does USART operate during sleep mode? In my design, I will need to wait to recieve some data from the HOST and if I recieve that certain data, I will need to send data back. My question is, what if the HOST sends me data while I am sleeping?

Added after 1 hours 20 minutes:

Another question. Say the HOST sends some data to my RX pin. In order for me to retrieve it, all I need is RCSTAbits.SPEN = 1; //Serial port enabled bit high correct? Does my clock need to be at the same rate for the baud rate? I want to know if I can recieve data just with my Watchdog Timer enabled...

Thanks in advance!

Added after 15 minutes:

Another question. Say the HOST sends some data to my RX pin. In order for me to retrieve it, all I need is RCSTAbits.SPEN = 1; //Serial port enabled bit high correct? Does my clock need to be at the same rate for the baud rate? I want to know if I can recieve data just with my Watchdog Timer enabled...

Thanks in advance!
 

hfintosc usart

well, at true sleep operation, all clocks are stoped, so the usart will not work...


But some pics, (sorry, I couldn´t check your pic) can stop the main clock but will continue to clock the peripherals, (Including you USART) which is called Idle State (PRI_RUN if I remmber)...

your clock rate could be far upper, for Usart recieving, the actual baud rate, is set by a baud rate generator registers, and need at least a main clock 16 times higher... (as far as I remember)

Also ,check the data sheet, but I think you need to set one additioanl bit, a CREN (continous receive)..

also as blueroom said, the Watchdog has it´s own timer, It can work while recieving data..

Jut a Little question... Why your main application is working at 31kHz? it's too low to work with the usart...
 

    M3GAPL3X

    Points: 2
    Helpful Answer Positive Rating
low power usart pic

Hi Kurenai_ryu,

I'll check that in the datasheet today.

My main clock is running that 31 kHz because my program has to sleep and wake up every 8 ms to check inputs. This is mainly to conserve power. I had to enable the watchdog timer to do this and in turn, the watchdog timer uses a 31 kHz clock. So that is the reason why my 31 kHz is my main clock.

Within the 8 ms, my program will constantly check the inputs, ADC and the USART reciever (RX) for a certain bit and go to sleep after 8 ms and wake up again after 8 ms. The USART function will enable the 8 MHz clock each time (every 8 ms) for baud rate generation and checking inputs and than switch back to the 31 kHz clock. If that certain bit is recieved, the USART will send stuff back to the HOST. All of this will be done in the 8 ms watchdog timer.

Is this the best way to go about this???

I will post some code later on to show you what I am doing. Thanks!

Added after 3 hours 38 minutes:

Do you guys think that I should just run my PIC at 8 MHZ for my main frequency? Would this take a lot of power?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top