Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | PLEASE CHECK THIS PROGRAM FOR PWM FOR PIC12F675

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

PLEASE CHECK THIS PROGRAM FOR PWM FOR PIC12F675 - vaishnavi236 - Feb 18 11:32:00 2004

FOR PWM OPTION equ 81h
INTCON equ 0bh
TMR equ 01h
Bcf OPTION ,5 ; TOCS TMR0 CLOCK SOURCE SELECT
; 0=> INTERNAL INSTRUCTION CYCLE CLOCK
bsf OPTION ,3 ; PSA PRESCALER ASSIGNMENT 0=> IS ASSIGNED TO WDT

movlw ; I HAVE NOT YET CALCULATED THE VALUE TO
BE FED
; TO TIMER
movwf TMR0
bcf INTCON,2 ; clear TMR 0 overflow indication
; TOIF 1=TMR0 REG HAS OVERFLOWED & 0=DID
NOT
TMR0: BTFSS INTCON,2 ;BIT TEST F ,SKIP IF SET
GOTO TMRO
Bcf INTCON,2
TMR1L equ 0Eh
TMR1H equ 0Fh
PIE 1 equ 8Ch
T1CON equ 10h
PIR1 equ 0Ch
Clrf TMR1L
Clrf TMR1H
Bcf PIR1,0 ; TMR1F TMR1 OVERFLOW INTERRUPT FLAG
Bsf PIE 1,0 ; TMR1E TMR1 OVERFLOW INTERRUPT ENABLE BIT
Bsf INTCON,6 ; PEIE peripheral interrupt enable bit
Bsf INTCON,7 ; GIE global interrupt enable bit
Bcf T1CON,0 ; STOP TIMER 1
Movlw ; I have not yet calculated the values to be put in
the timer
Movwf TMR1L
Movlw
Movwf TMR1H
Bsf T1CON,1
Movlw
Movwf T1CON
TMR 1: BTFSS PIR 1,0
GOTO TMR1
Bcf PIR 1,0 PLEASE SEND ME UR SUGGESTIONS REGARDING THESE PROGRAMS

REGARDS,
VAISHNAVI





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


Re: PLEASE CHECK THIS PROGRAM FOR PWM FOR PIC12F675 - Patrick Reitelbach - Feb 24 9:09:00 2004

First, use f675temp.asm & PIC12f675.inc (included with mplab) to get
started. This will give you a working baseline. Read the template
file and understand the sections in there. Delete what you do not
need.

You need to watch your register names and goto tags spelling. See
below...

Look in Microhip document DS33023A - PICMicro Mid-Range MCU Family
Reference Manual. Section 11.6.2, Example 11-3, page 11-9 for example
of using TMR0 and Section 12.11, Example 12-4, page 12-10 for example
of using TMR1.

Using the template file, code your application and try assembling
it. The assembler will point out these (and other) errors. Of
course even when it assembles OK does not mean the program will work
as intended. Then the real debugging begins.

pr --- In , "vaishnavi236" <vaishnavi236@y...>
wrote:
> FOR PWM > OPTION equ 81h
> INTCON equ 0bh
> TMR equ 01h

is TMR0 (zero on the end)

> Bcf OPTION ,5 ; TOCS TMR0 CLOCK SOURCE SELECT
> ; 0=> INTERNAL INSTRUCTION CYCLE CLOCK
> bsf OPTION ,3 ; PSA PRESCALER ASSIGNMENT 0=> IS ASSIGNED TO
WDT

OPTION,3 = 1 = prescaller assigned to WDT, = 0 = assigned to TMR0 > movlw ; I HAVE NOT YET CALCULATED THE VALUE
TO
> BE FED
> ; TO TIMER
> movwf TMR0

you defined it as TMR so TMR0 does not exist. Use the include file
to provide names and assignments for all the registers and bits.

> bcf INTCON,2 ; clear TMR 0 overflow indication
> ; TOIF 1=TMR0 REG HAS OVERFLOWED & 0=DID
> NOT
> TMR0: BTFSS INTCON,2 ;BIT TEST F ,SKIP IF SET

Should not use register name for a goto tag

> GOTO TMRO

I see TMRO ( that is the letter O on the end and not the numeral zero,
so this does not exist.)

> Bcf INTCON,2

> TMR1L equ 0Eh
> TMR1H equ 0Fh
> PIE 1 equ 8Ch
> T1CON equ 10h
> PIR1 equ 0Ch
> Clrf TMR1L
> Clrf TMR1H
> Bcf PIR1,0 ; TMR1F TMR1 OVERFLOW INTERRUPT FLAG
> Bsf PIE 1,0 ; TMR1E TMR1 OVERFLOW INTERRUPT ENABLE BIT
> Bsf INTCON,6 ; PEIE peripheral interrupt enable bit
> Bsf INTCON,7 ; GIE global interrupt enable bit

I don't think you need to enable interrupts to have the flag bit work.

> Bcf T1CON,0 ; STOP TIMER 1

I would stop the timer first before writting any of it registers

> Movlw ; I have not yet calculated the values to be
put in
> the timer
> Movwf TMR1L
> Movlw
> Movwf TMR1H
> Bsf T1CON,1
> Movlw
> Movwf T1CON
> TMR 1: BTFSS PIR 1,0
> GOTO TMR1
> Bcf PIR 1,0 > PLEASE SEND ME UR SUGGESTIONS REGARDING THESE PROGRAMS
>
> REGARDS,
> VAISHNAVI





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: PLEASE CHECK THIS PROGRAM FOR PWM FOR PIC12F675 - vaishnavi236 - Feb 26 6:36:00 2004

hello,
THANK YOU SIR FOR TELLING ME THE PROCEDURE TO check the pgm i
have written the adc pgm accordingly -- In , "Patrick Reitelbach"
<preitelbach@y...> wrote:
> First, use f675temp.asm & PIC12f675.inc (included with mplab) to
get
> started. This will give you a working baseline. Read the template
> file and understand the sections in there. Delete what you do not
> need.
>
> You need to watch your register names and goto tags spelling. See
> below...
>
> Look in Microhip document DS33023A - PICMicro Mid-Range MCU Family
> Reference Manual. Section 11.6.2, Example 11-3, page 11-9 for
example
> of using TMR0 and Section 12.11, Example 12-4, page 12-10 for
example
> of using TMR1.
>
> Using the template file, code your application and try assembling
> it. The assembler will point out these (and other) errors. Of
> course even when it assembles OK does not mean the program will
work
> as intended. Then the real debugging begins.
>
> pr > --- In , "vaishnavi236" <vaishnavi236@y...>
> wrote:
> > FOR PWM
> >
> >
> > OPTION equ 81h
> > INTCON equ 0bh
> > TMR equ 01h
>
> is TMR0 (zero on the end)
>
> > Bcf OPTION ,5 ; TOCS TMR0 CLOCK SOURCE SELECT
> > ; 0=> INTERNAL INSTRUCTION CYCLE CLOCK
> > bsf OPTION ,3 ; PSA PRESCALER ASSIGNMENT 0=> IS ASSIGNED TO
> WDT
>
> OPTION,3 = 1 = prescaller assigned to WDT, = 0 = assigned to TMR0
>
> >
> > movlw ; I HAVE NOT YET CALCULATED THE VALUE
> TO
> > BE FED
> > ; TO TIMER
> > movwf TMR0
>
> you defined it as TMR so TMR0 does not exist. Use the include file
> to provide names and assignments for all the registers and bits.
>
> > bcf INTCON,2 ; clear TMR 0 overflow indication
> > ; TOIF 1=TMR0 REG HAS OVERFLOWED & 0=DID
> > NOT
> > TMR0: BTFSS INTCON,2 ;BIT TEST F ,SKIP IF SET
>
> Should not use register name for a goto tag
>
> > GOTO TMRO
>
> I see TMRO ( that is the letter O on the end and not the numeral
zero,
> so this does not exist.)
>
> > Bcf INTCON,2
>
> > TMR1L equ 0Eh
> > TMR1H equ 0Fh
> > PIE 1 equ 8Ch
> > T1CON equ 10h
> > PIR1 equ 0Ch
> > Clrf TMR1L
> > Clrf TMR1H
> > Bcf PIR1,0 ; TMR1F TMR1 OVERFLOW INTERRUPT FLAG
> > Bsf PIE 1,0 ; TMR1E TMR1 OVERFLOW INTERRUPT ENABLE BIT
> > Bsf INTCON,6 ; PEIE peripheral interrupt enable bit
> > Bsf INTCON,7 ; GIE global interrupt enable bit
>
> I don't think you need to enable interrupts to have the flag bit
work.
>
> > Bcf T1CON,0 ; STOP TIMER 1
>
> I would stop the timer first before writting any of it registers
>
> > Movlw ; I have not yet calculated the values to be
> put in
> > the timer
> > Movwf TMR1L
> > Movlw
> > Movwf TMR1H
> > Bsf T1CON,1
> > Movlw
> > Movwf T1CON
> > TMR 1: BTFSS PIR 1,0
> > GOTO TMR1
> > Bcf PIR 1,0
> >
> >
> > PLEASE SEND ME UR SUGGESTIONS REGARDING THESE PROGRAMS
> >
> > REGARDS,
> > VAISHNAVI




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )