Searching \ for 'Help on program structure' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=help+program+structure
Search entire site for: 'Help on program structure'.

Truncated match.
PICList Thread
'Help on program structure'
1998\11\21@000638 by Jim Kueneman

picon face



  I have been trying to come up with the best (ok..ANY) solution to my
problem.  I want to use a 16F84 for this.  I have seen a product on the
market using the '84 that does what I want to do so I know it can be done.

 I need to generate a PWM with 128 steps of Duty Cycle, the frequency is
up to me it can be low. At the same time I need to watch an input pin that
has a serial stream encoded using a pulse width scheme.  The width of a "1"
is between 52us and 64us and a "0" is between 90us and 10000us.

 My first thought was to use the technique in a Microchip appnote on "time
slicing" a PWM machine.  The "machine" is called in predetermined intervals
buy blocking the code into equal number of clock cycles between each call.
The problem is the PWM with this approach. It causes a timing problem for
the PWM machine if I use the Port Pin Change interrupt to catch the rising
and falling edges and time them.  At 20Mhz I could poll the pin every 10
instructions for a +-2us resolution, not very elagant.

 Does anyone have a innovative way to do this.

 Thanks
 Jim Kueneman

1998\11\23@080932 by Stefan Sczekalla-Waldschmidt

flavicon
face
Jim Kueneman wrote:
>
>    I have been trying to come up with the best (ok..ANY) solution to my
> problem.  I want to use a 16F84 for this.  I have seen a product on the
> market using the '84 that does what I want to do so I know it can be done.
>
>   I need to generate a PWM with 128 steps of Duty Cycle, the frequency is
> up to me it can be low. At the same time I need to watch an input pin that
> has a serial stream encoded using a pulse width scheme.  The width of a "1"
> is between 52us and 64us and a "0" is between 90us and 10000us.

Are you gowing to write an NMRA DCC dekoder ???

Kind regards

       Stefan Sczekalla-Waldschmidt
       spam_OUTsswTakeThisOuTspamoikossw.de

>

1998\11\23@084706 by Jim Kueneman

picon face
At 02:07 PM 11/23/98 +0100, you wrote:
>Jim Kueneman wrote:
>>
>>    I have been trying to come up with the best (ok..ANY) solution to my
>> problem.  I want to use a 16F84 for this.  I have seen a product on the
>> market using the '84 that does what I want to do so I know it can be done.
>>
>>   I need to generate a PWM with 128 steps of Duty Cycle, the frequency is
>> up to me it can be low. At the same time I need to watch an input pin that
>> has a serial stream encoded using a pulse width scheme.  The width of a "1"
>> is between 52us and 64us and a "0" is between 90us and 10000us.
>
>Are you gowing to write an NMRA DCC dekoder ???
>


 Why yes I am  :^)   Have any hints?

Jim

1998\11\23@142957 by Scott Dattalo

face
flavicon
face
Jim Kueneman wrote:
>
> At 02:07 PM 11/23/98 +0100, you wrote:
> >Jim Kueneman wrote:
> >>
> >>    I have been trying to come up with the best (ok..ANY) solution to my
> >> problem.  I want to use a 16F84 for this.  I have seen a product on the
> >> market using the '84 that does what I want to do so I know it can be done.
> >>
> >>   I need to generate a PWM with 128 steps of Duty Cycle, the frequency is
> >> up to me it can be low. At the same time I need to watch an input pin that
> >> has a serial stream encoded using a pulse width scheme.  The width of a "1"
> >> is between 52us and 64us and a "0" is between 90us and 10000us.
> >
> >Are you gowing to write an NMRA DCC dekoder ???
> >
>
>   Why yes I am  :^)   Have any hints?
>
> Jim

You could take at look at this all-software 256 level pwm routine:

http://www.interstice.com/~sdattalo/technical/software/pic/pwm256.txt

It's written such that it has single-cycle resolution and about 100-150
cycles left over for other tasks.

Scott

1998\11\23@215407 by Valter Gruntar
flavicon
face
I'm interested to for this decoder. Take a look to this url.
http://ourworld.compuserve.com/homepages/Dprobst/ndecoder.htm

ourworld.compuserve.com/homepages/Dprobst/decoder.zip
I've already downloaded this decoder, but it's hard to understand how the
program works. If you'll find out the solution let me know.
hope this help you.

VALTER


Jim Kueneman wrote:

{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...