go away spammer

Author Topic: Configuring 16F877A PWM -  (Read 7640 times)

0 Members and 1 Guest are viewing this topic.

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Configuring 16F877A PWM -
« on: May 11, 2007, 12:38:14 AM »
I was wondering if anyone could explain how to set up the 16F877A PWM functions - I have been messing with it all day and haven't gotten it to work- I looked at the data sheet but It did not give an easily understandable step by step procedure for setting it up -

I am looking to have it pulse out a 38Khz square wave with a 50% duty cycle,

The Crystal is 20Mhz thats being used.


Thanks -

 
« Last Edit: May 11, 2007, 02:41:52 AM by Eco19R »

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Configuring 16F877A PWM -
« Reply #1 on: May 11, 2007, 04:42:54 AM »
If you're trying to do that, it typically means you're running an IR LED, and using a IR receiver, correct?

I used to worry about that, but then I found this cool new sensor, which I used on my near-IR sensor on Seeker 2, my autonomous mini-sumo. It is like the standard 3-pin IR sensor, except it has a 4th pin, which is PWM at 38 KHz with a 50% duty cycle...

The Sharp IS471F is the sensor in question - I have a picture of my entire near-ir sensor here: http://www.huv.com/near-ir.jpg

- Jon

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Configuring 16F877A PWM -
« Reply #2 on: May 11, 2007, 12:59:34 PM »
If you're trying to do that, it typically means you're running an IR LED, and using a IR receiver, correct?

I used to worry about that, but then I found this cool new sensor, which I used on my near-IR sensor on Seeker 2, my autonomous mini-sumo. It is like the standard 3-pin IR sensor, except it has a 4th pin, which is PWM at 38 KHz with a 50% duty cycle...

The Sharp IS471F is the sensor in question - I have a picture of my entire near-ir sensor here: http://www.huv.com/near-ir.jpg

- Jon


Thanks for responding -

Yes - Its for basic obstacle avoidance - I will defiantly check out the sensor you talked about but the PCB I made has the IR Transmiter/Receiver built onto it - in the future I will avoid this mistake but its fairly important that I am able to get the board Ir pair up and running - I know its possible because I did it before - recently I did a system reinstall and lost all the source code - I am going to get flamed for this but normally I program the PICs with Pic Basic Pro (I know allot of people hate basic but its fine for what I am doing) To directly write to a register you -

{Register name} {Value to be written}

It says in the data sheet you write the first 8 MSB to the CCPR1L and the two LSB to the CCP1CON register

I found a useful tool called PIC Multi Calc - http://www.mister-e.org/pages/utilitiespag.html 

My main issue is that I'm not sure what exactly to write to these two registers -  Pic Multi Calc says to write 264 to the duty register but I don't know how to enter that in correctly into the two registers - My calculator says in binary its 1000010000 but it still leaves the question of what gets entered where.

Thanks - 

 


Get Your Ad Here