Last two questions (I hope so )
in Bruce's Example he's multiplying pdcx by (Lowbyte,Highbyte) Low and high byte of what and what is the purpose of doing that ?
also
anyway I'm going to post the Code since I can't find the problem yet .. what I'm Trying to do is to generate a sinewave from pwm0 with an offset to use that later in a three phase inverter.. so I made this test which gives unexpected results
what I'm trying to do is using entries from a lookup table to generate pulses with duty cycles starting from 1000 to 2000 then back to 1000 (Positive half Cycle) after that going from 1000 to 0 and going back again to 1000 (Negative half Cycle) which isn't happening ..
I'm using 10MHz osc 18f4431, and a lookup table of 25 Entries (Which isn't enough for a smooth wave but this is for testing)
Code:
PORTB = 0
TRISB = %11000000 ' pwm0-5 output
PTCON0 = %00000000 ' (1:1) prescale , Free-Running mode
PTCON1 = %10000000 'time base is on, Counting is up
PWMCON0 = %01000000 'Pwm0-5 enbbled for pwm output, pwm0-5 complementary mode
PWMCON1 = %00000001
OVDCOND = %11111111
PTPERL = $D0
PTPERH = $07 'PTPER = 2000
Main:
PDC0L = 00
PDC0H = 10
PDC0L = 59
PDC0H = 12
PDC0L = 00
PDC0H = 15
PDC0L = 07
PDC0H = 17
PDC0L = 66
PDC0H = 18
PDC0L = 66
PDC0H = 19
PDC0L = 00
PDC0H = 20
PDC0L = 66
PDC0H = 19
PDC0L = 66
PDC0H = 18
PDC0L = 07
PDC0H = 17
PDC0L = 00
PDC0H = 15
PDC0L = 59
PDC0H = 12
PDC0L = 00
PDC0H = 10
PDC0L = 41
PDC0H = 07
PDC0L = 00
PDC0H = 05
PDC0L = 93
PDC0H = 02
PDC0L = 34
PDC0H = 01
PDC0L = 34
PDC0H = 00
PDC0L = 00
PDC0H = 00
PDC0L = 34
PDC0H = 00
PDC0L = 34
PDC0H = 01
PDC0L = 93
PDC0H = 02
PDC0L = 00
PDC0H = 05
PDC0L = 41
PDC0H = 07
PDC0L = 00
PDC0H = 10
GoTo Main
Thanks
Bookmarks