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.

pic program for mcu PIC 16C873

Status
Not open for further replies.

waghileni

Newbie level 3
Joined
Mar 15, 2011
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,304
hi
im new in mcu programming and I want to write the program which will generate signal at sampling frequency 1Hz and have active mode and sleep mode to the PIC 16C873
i need help coz im not familier with MPLAB
thanks
 

So you need to generate a signal of frequecy of 1Hz or you are sampling external data at 1Hz?

Regarding sleep and active modes, you can simply send the device to sleep using SLEEP() function. Activate interrupts before going to sleep. If you need to perform the task and go back to sleep again, simply put the SLEEP() function in while loop. This way, the controller wakes up on interrupt, goes to ISR and comes back into the while loop containing SLEEP().

Take care that after waking from sleep, the controller will perform one code line immediately after the SLEEP() function. So its advisable to put NOP() to avoid any unexpected operation.
 

hi thanks
just I want to sample axternal data at 1Hz and send it to output
 

At 1 Hz, you would probably need to start a timer interrupt. First you load the times value, and then enable it just before you are about to enter sleep. And as I said before, instead of NOP(), you can place the reloading condition for the timer.

so, it should look like,


timer reload;
while(1)
{
Timer enabled;
sleep();
timer reload;
}
 

thanks so i have another question can we include this program to the sleep mode and active mode and by puting interrupt command in the sleep mode?
 

can you reframe your question? not clear to me.

Sleep mode is the state when the controller is not active and vice versa. No code is executed while the Pic is in sleep mode, only an interrpt wakes it up, i.e., it comes in active mode and then executes whatever is required.
 

can you please explain to me how to writr the wholw program i,m little bit mixed up with the codes
 

I looked into the datasheet and realized that the timer interrupt cannot be used while in sleep mode, as the timer itself is not running.

So, either you dont go into sleep mode or, if you just need to process the current data, you could use a watchdog timer, which would wake the controller from sleep.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top