PDA

View Full Version : Plz give me working of timers in PIC16F676



Vishal Raut
- 24th May 2007, 16:17
I am developing a PIC16F676 based program for square wave inverter. I am using internal 4 MHz oscillator MCLRE off and i needed the information about how to configure the timers for a specific time delays. Plz give any formula if.

Melanie
- 24th May 2007, 17:06
Datasheet DS40039A. See Section 4 for Timer0 Module, see Section 5 for Timer1 Module. At 4MHz, one Timer tick is equal to 1uS. The sections are very clear as to the operation of the Timers, and the settings of the various Registers. DOWNLOAD the Datsheet from the Microchip website.

mister_e
- 24th May 2007, 20:56
Hi and welcome on the forum,
I'll suggest you to use my PicMultiCalc, it will help you to find the right setting. Click on Timer Helper and enter your parameter in.

Once you have them, just set the according register.

You can download it for free at the following link
http://www.mister-e.org/pages/utilitiespag.html

Enjoy!

Vishal Raut
- 25th May 2007, 16:24
Hi and welcome on the forum,
I'll suggest you to use my PicMultiCalc, it will help you to find the right setting. Click on Timer Helper and enter your parameter in.

Once you have them, just set the according register.

You can download it for free at the following link
http://www.mister-e.org/pages/utilitiespag.html

Enjoy!

Thanks Steve and I have visited ur site and i got surprised and happy with the solutions u provided. Thanks

Vishal Raut
- 25th May 2007, 16:28
Datasheet DS40039A. See Section 4 for Timer0 Module, see Section 5 for Timer1 Module. At 4MHz, one Timer tick is equal to 1uS. The sections are very clear as to the operation of the Timers, and the settings of the various Registers. DOWNLOAD the Datsheet from the Microchip website.

Thank u very much for ur guidance and solutions. I have got the solutions to my prorgram with ur help. Actually I am new boy in the PICs world.DAy by day i will get mature. Can u give solutions if i have difficukties in future. Do reply. Thanks again.

Vishal Raut
- 20th June 2007, 17:10
I am using timer0 in PIC 16F676 for PWM generation. I am giving the steps i followed for the general controller initialization and interrupt initialization. Its not working well. i have to made power ON/OFF several times then PWM generation starts,the part before interrrupt initialization is working well.I am also using ADC but without interrupts.I am using internal osc. without clk,MCLRE disabled.Plz also give how to write configuration bits in MPLAB software,ITS HURRY, Thanks.

mister_e
- 20th June 2007, 17:26
Deuh, sure it's not your whole program....


Make: The target "C:\ASM_PROG\pwm676.o" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F676 "pwm676.asm" /l"pwm676.lst" /e"pwm676.err"
Error[113] C:\ASM_PROG\PWM676.ASM 12 : Symbol not previously defined (SAVE_WREG)
Error[113] C:\ASM_PROG\PWM676.ASM 14 : Symbol not previously defined (SAVE_STATUS)
Error[113] C:\ASM_PROG\PWM676.ASM 16 : Symbol not previously defined (SAVE_PCLATH)
Error[113] C:\ASM_PROG\PWM676.ASM 18 : Symbol not previously defined (ON_TIME_SET)
Error[113] C:\ASM_PROG\PWM676.ASM 23 : Symbol not previously defined (INT_CHK)
Error[113] C:\ASM_PROG\PWM676.ASM 25 : Symbol not previously defined (FIRST_CHK)
Error[113] C:\ASM_PROG\PWM676.ASM 27 : Symbol not previously defined (FIRST_CHK)
Error[113] C:\ASM_PROG\PWM676.ASM 30 : Symbol not previously defined (SAVE_STATUS)
Error[113] C:\ASM_PROG\PWM676.ASM 32 : Symbol not previously defined (SAVE_PCLATH)
Error[113] C:\ASM_PROG\PWM676.ASM 34 : Symbol not previously defined (SAVE_WREG)
Message[302] C:\ASM_PROG\PWM676.ASM 42 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 44 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 45 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 48 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 52 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 60 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 62 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\ASM_PROG\PWM676.ASM 76 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[113] C:\ASM_PROG\PWM676.ASM 82 : Symbol not previously defined (ON_TIME_SET)
Halting build on first failure as requested.
BUILD FAILED: Wed Jun 20 12:27:14 2007


and your condif fuse line MUST looks like


__CONFIG _INTRC_OSC_NOCLKOUT & _CPD_OFF & _CP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF

Vishal Raut
- 4th July 2007, 16:58
Thanks friends for giving attention on my thread.I am feeling very happy to say that i have got the solutions from microchip pdf files and prog is working nicely.