- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to controle 5 servo (9g) by ADC (input from potentiometre) from 0 To180°
thank you
secound step ; how to use uart to sent 'analog input' to an other Psoc to controle the same 5 servo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The specs for your servo are:
Pulsewidth = 1ms -> Leftmost position
Pulse width = 2 ms -> Rightmost position
Repitition rate 20ms / 50 Hz
So what you need is a PWM component configured to a period of 20ms. By setting the compare value accordingly you will be able to control the servo position at your need.
Example:
Input clock 1MHz
16 bit wide PWM USB type. One output
Period value 19999
Compare value 999 to 1999
You will need a function that converts your ADC result to the required compare - value (ADC * Gain + 999)
"secound step ; how to use uart to sent 'analog input' to an other Psoc to controle the same 5 servo "
You will have to design a communication protocol. This fixes
What is sent
Who may send
What is the response (good / bad)
best could be to define a structure of the data to be send which contaoins a lead-in (starter byte) and a lead-out (end byte) which allows for synchronization of the input stream. Both of your PSoCs may not be switched on at the same time or when a byte was lost this feature will be very helpful.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The specs for your servo are:
Pulsewidth = 1ms -> Leftmost position
Pulse width = 2 ms -> Rightmost position
Repitition rate 20ms / 50 Hz
So what you need is a PWM component configured to a period of 20ms. By setting the compare value accordingly you will be able to control the servo position at your need.
Example:
Input clock 1MHz
16 bit wide PWM USB type. One output
Period value 19999
Compare value 999 to 1999
You will need a function that converts your ADC result to the required compare - value (ADC * Gain + 999)
"secound step ; how to use uart to sent 'analog input' to an other Psoc to controle the same 5 servo "
You will have to design a communication protocol. This fixes
What is sent
Who may send
What is the response (good / bad)
best could be to define a structure of the data to be send which contaoins a lead-in (starter byte) and a lead-out (end byte) which allows for synchronization of the input stream. Both of your PSoCs may not be switched on at the same time or when a byte was lost this feature will be very helpful.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you want to use sprintf() you need to
set the heap size to 0x0200 (in System view)
enable newlib nano float formatting (in Project-> Build settings->Linker)
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content