Controlling Maestro 6 channel servo controller
- mileta.miletic
- mikroElektronika team
- Posts: 493
- Joined: 05 Jun 2009 14:46
- Location: Belgrade, Serbia
- Contact:
Hi,
check Manchester example, part of the code use timers and interrupts to measure the length of the pulse, it could help:
http://www.mikroe.com/forum/viewtopic.php?p=36740#36740
check Manchester example, part of the code use timers and interrupts to measure the length of the pulse, it could help:
http://www.mikroe.com/forum/viewtopic.php?p=36740#36740
Regards,
Mileta
Mileta
-
- Posts: 715
- Joined: 27 Dec 2006 14:33
- Location: Le Tréport , FRANCE
there are some at http://www.mikroe.com/forum/viewtopic.php?t=16606, wondering if i could modify them for use with more than one channel
Code: Select all
void main() {
TRISA=0b01000010; // Added 0b for binary
TRISB=0b00000000; // Added 0b for binary
Soft_UART_Init(PORTA, 1, 2, 9600, 0);
Delay_ms(5000);
while(1)
{
Soft_UART_Write(0xAA);
Soft_UART_Write(12);
Soft_UART_Write(4);
Soft_UART_Write(0);
Soft_UART_Write(112);
Soft_UART_Write(46);
///Soft_UART_Write(132);
///Soft_UART_Write(0);
///Soft_UART_Write(112);
///Soft_UART_Write(46);
Soft_UART_Break();
PORTB=255;
Delay_ms(500);
PORTB=0;
Delay_ms(500);
}
}
Hi,
vanepico is right. All you need to do is correct Soft_Uart_init to look like this:
Your code works just fine, I have tested it using PIC16F84A @ 4MHz XT oscillator.
Best regards,
Aleksandar
vanepico is right. All you need to do is correct Soft_Uart_init to look like this:
Code: Select all
Soft_UART_Init(&PORTA, 1, 2, 9600, 0);
Best regards,
Aleksandar
Web Department Manager
Hi,
You may use whichever you want. There are advantages and disadvantages in each:
1. UART is much more reliable, because it uses internal hardware module for communication and error detection. But you can only use it on specific PORT pins, which are defined as module output.
2. Soft_Uart is a software simulation of this hardware module, so it relies on much more factors which all have certain room for errors, so in final summation, Soft_Uart is less reliable than UART. Nevertheless, it has the advantage of being able to be tied to any available PORT pins.
3. Alternatively you should consider using hardware UART on chips where you can program the output pin location. Peripheral Pin Select option is now introduced in many new chips, so you should check it out. We have a library that supports those hardware options.
Best regards,
Aleksandar
You may use whichever you want. There are advantages and disadvantages in each:
1. UART is much more reliable, because it uses internal hardware module for communication and error detection. But you can only use it on specific PORT pins, which are defined as module output.
2. Soft_Uart is a software simulation of this hardware module, so it relies on much more factors which all have certain room for errors, so in final summation, Soft_Uart is less reliable than UART. Nevertheless, it has the advantage of being able to be tied to any available PORT pins.
3. Alternatively you should consider using hardware UART on chips where you can program the output pin location. Peripheral Pin Select option is now introduced in many new chips, so you should check it out. We have a library that supports those hardware options.
Best regards,
Aleksandar
Web Department Manager