PWM on PIC18F4331 and also RS-485 control

General discussion on mikroC.
Post Reply
Author
Message
_Peter_
Posts: 45
Joined: 28 Apr 2005 08:57
Location: Sweden

PWM on PIC18F4331 and also RS-485 control

#1 Post by _Peter_ » 06 May 2005 16:49

Hi

Does anyone know how to use more than one PWM on th PIC via MikroC?
I need to control several H-bridges with PWM via analog joysticks.

I'm also working on a school project with an old Videmech 682 video pan/tilt head.

http://www.axis.com/techsup/cam_servers ... ch_682.htm

It uses a RS-485 protocol but since I've never used that protocol it's kinda tricky. If someone's got some old MikroC RS-485 project to share I'd be thankful.
BTW I've got thedatasheet and protocol for the pan/tilt head if someone wants it...

Thanks
/Peter

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#2 Post by LGR » 06 May 2005 17:50

1. PWM: As I understand, there is no library routine for second PWM, you have to set registers, etc.

2. RS-485 isn't a complete communication stack, it is only a physical layer. You need information on the specific protocol used in your equipment to communicate. From what I have seen, it is usually easier to use the USART library when communicating with an existing protocol. The RS-485 library is generally suited for a network where all nodes are programmed with the mikro compilers.
If you know what you're doing, you're not learning anything.

_Peter_
Posts: 45
Joined: 28 Apr 2005 08:57
Location: Sweden

pwm

#3 Post by _Peter_ » 07 May 2005 16:01

LGR wrote:1. PWM: As I understand, there is no library routine for second PWM, you have to set registers, etc.

2. RS-485 isn't a complete communication stack, it is only a physical layer. You need information on the specific protocol used in your equipment to communicate. From what I have seen, it is usually easier to use the USART library when communicating with an existing protocol. The RS-485 library is generally suited for a network where all nodes are programmed with the mikro compilers.
Hi.

Thanks for your reply.
What do you mean by setting registers, etc?

/Peter

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: pwm

#4 Post by rajkovic » 07 May 2005 21:15

LGR wrote:1. PWM: As I understand, there is no library routine for second PWM, you have to set registers, etc.

Thanks for your reply.
What do you mean by setting registers, etc?

/Peter
Library does settings of registers that means make correct Frequency and duty cycle, starts and stops, pwm module ...
Why we did not make library for this chip?

For enhached PWM like those with 2331 it seems that you have some serious PWM in mind, and you probably want full control, to put calculated values in register without overhaed that makes call of library function. but it seems that so many of our user are interested in PWM library ok we will made it...

Dale Stewart
Posts: 39
Joined: 05 Jan 2005 04:49
Location: Wollongong, Australia

Re: PWM on PIC18F4331 and also RS-485 control

#5 Post by Dale Stewart » 09 May 2005 15:14

_Peter_ wrote:
Does anyone know how to use more than one PWM on th PIC via MikroC?
I need to control several H-bridges with PWM via analog joysticks.


Thanks
/Peter
I posted a similar question almost a month ago.

Well I could have waited a few more weeks ( ? ) for the forthcoming example from mE, but I saved myself the trouble and bought CCS C compiler. It has functions for up to 5 PWM. It is <= $USD 125 ( but only for the 16 series ).

If you are intermediate PIC user then you can come up with a work around, but for newbies, the time input is not worth it if you don't have much time.

I am surprised that nobody in the forum has posted a work around.:o

If I knew how to I would post it. You never know, maybe I will learn it myself and post it before the new mE PWM functions become available :idea:

I am a happy customer of mE, and have spent hundreds of $AUD so far on the hardware, but I will not be forking out hundreds more $ for the compiler until it is mature, and there is at least somewhere to post and receive newbie-level code; as well as more detailed explanations ( dummied down ) and examples - read:

Why is the BASIC Stamp the most successful ( student, enthusiast ) MCU system in the history of the universe?
Go to their Web site and see - they have many downloadable PDF books -literally thousands of pages of such material, not to mention the numerous articles published ( i.e. NutsnVolts ), and there are many books published.

I think mE has a lot of potential, and "Rome wasn't built in a day" - so my advice ( for what it's worth ) is to emulate the Parallax model.

So chaps, take the bull by the horns, seize the opportunity and do for C what parallax has done for BASIC. No one has really been able to accomplish this. It is early days, but I believe that if you can really do this, you will succeed in years to come to the extent Parallax has with the Stamp ( and now Ubicom ).

By the way, I recently wrote a letter to "Everyday Practical Electronics" in the UK suggesting they start writing articles for programming PICs in C, and guess which IDE I suggested - yep mikroC.

I also gave mikroC a very good rating on my web site.

Please take my criticism as constructive...:wink:

Cheers and best wishes

Dale

Bertolo
Posts: 1
Joined: 08 Dec 2011 01:30

Re: PWM on PIC18F4331 and also RS-485 control

#6 Post by Bertolo » 08 Dec 2011 01:36

Peter, if you have the protocol for the Videmech 682 pan/tilt head, I'd love to have it. I believe it is called "Universal Outstation Communications Protocol".

Thank you!
Howard

Post Reply

Return to “mikroC General”