Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] PPM signal from 8051 to control DC motor

Status
Not open for further replies.

Js_Ong

Member level 4
Member level 4
Joined
Jan 15, 2007
Messages
68
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
1,796
Hi,

I have a DC motor come with a driver attached which say can accept PPM signal. How can I write a signal pulse to trigger the motor? Reverse 0.6ms, Stop 1.5ms, Foward 2.4ms. And the data sheet say the motor will run at the last speed even the PPM signal has been disconnected. I had write a normal pulse with above timing using 8051 but the motor is not running as expected. What was wrong about the PPM signal?
 

As it seems looking to your time stamps, a 0.3ms time base is common for all the operations. You can use timer to create signals only if you are clocking your 8051 in high speed. Use a round up value crystals like 12MHz. Or you can use simple counting loops to waste time and create delay of 0.3ms. Call the delay 2 times for reverse, 5 times for stop and 8 times for forward. Try to hold your pulse for around 50 to 100us before pulling it down.
It would be helpful if you can attach any link to the datasheet and paste your code here.
 

Pls look fr Robokit website the motor model RMCS 2104. That is the only info I hv to use the PPM in controlling the motor. Why different time of pulse given fr different control?
 

Why different time of pulse given fr different control?

Different time of pulse are like a 'time stamp' and the receiver end already knows what to do when such specific kind of pulses are received. Any other pulses not recognized by the receiver will be ignored.

Can you attach your code here??
 

Hi Genovator,

Below my code in assembly. One pulse given. Please leet me know what's wrong?


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ORG 0000H
 
                MOV TMOD,#10H   ;TIMER 1, MODE 1 16 BITS
                
                MOV A,0
                MOV P1, A       
                MOV A, #0FFH
                MOV P2, A               
 
START:  JB P2.0, FORWARD
                JB P2.1, STOP
                JMP START
 
 
STOP:   CLR P1.0
                MOV R0,#99H     ;1.5ms
                MOV R1,#0FAH
                CALL TIMER
                JMP START
 
FORWARD:        CLR P1.0
                MOV R0,#5CH     ;2.4ms
                MOV R1,#0F7H
                CALL TIMER
                JMP START
                
 
 
TIMER:  MOV TL1,R0
                MOV TH1,R1
                SETB TR1
 
                JNB TF1,$
                CLR TR1
                CLR TF1
                
                CPL P1.0
 
                RET

 
Last edited by a moderator:

You haven't mentioned your clock speed, but by your code it seems you are driving a ppm signal with 2.4ms for both mark time and space time. And your output signal is of perfect 50% duty cycle. Your resultant frequency is 4.8ms, not 2.4ms. Are you sure this kind of signalling is required?

PPM is generally of two types: Positive modulated and negative modulated. See here.

In most devices, +ve PPM is used. I think you should try it once.

Advises: Ports and their respective bits are direct addressable. So you can write 'MOV P0, 0H' insteade of using accumulator.
Don't use P1.0 and P1.1 if they don't have internal pull-ups like 89c2051.
 

Hi Genovator,

I am using crystal 11.0898MHz with 89S52. The motor datasheet as below link. See page 2 about the pulse width. I do not know that I need to divide into 2 for the timing. And how do I know that the PPM used in this motor is positive or negative edge?

http://robokitsworld.com/documentation/Cur_Driver.pdf
 

When creating time delays, its better to use round-up value crystals such as 6MHz, 8MHz or 12MHz.
Try to find a 12MHz crystal.
I have seen that datasheet. well, it isn't actually a datasheet. More like a product brochure. They didn't shared much of the technical infos. Rather, they want us to rely on PPM receiver modules. They mentioned that the motor can be controlled by any PPM RC receiver. So a google search reveals RC receivers works with +ve PPM modulation. Assuming it is going to work on that, try this code...

Code:
ORG 00H
JMP START

ORG 30H

START:

JNB P2.0, FORWARD
JNB P2.1, STOP
JMP START


STOP:
CLR P1.0
CALL DELAY

SETB P1.0
CALL DELAY

CLR P1.0
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY

JMP START


FORWARD:
CLR P1.0
CALL DELAY

SETB P1.0
CALL DELAY

CLR P1.0
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY

JMP START


DELAY:
MOV R0, #16H

LOOP:
DJNZ R0, LOOP

RET


END

Reason behind using long list of DELAYs is just to check if this signalling pattern works. You can change it with timer if you wish. If it doesn't work, try replacing 'JB' with 'JNB'. I don't know why my simulator got confused between 'JB' and 'JNB'.
 
  • Like
Reactions: Js_Ong

    Js_Ong

    Points: 2
    Helpful Answer Positive Rating
Hi Genovator,

Thanks for the advice. I had re- programme the code, and now it works. WIth the timing specified, ON OFF ON OFF.

I will post another problem that I am facing now.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top