Download pr24 pid motor controller

Transcript
ROBOT . HEAD to TOE
PR24 – PID Motor Controller
and IN2 are HIGH, the motor will stop. After
determine the direction, the speed in the form
of PWM will go to EN1 of the motor driver to
determine the speed of motor.
7. Function for LCD
7.1 send_config
Figure 29 shows the function to configure
LCD. In order to configure LCD, we need
to set RS=0. The configuration needs to
detect one bit by one bit, therefore a loop
with 8 cycles is need for shift the data to
right. e_pulse function is used after the
loop for send the pulse to E pins of LCD.
The E pin is used for start data read and
write.
Figure 31
This function is used for set the cursor of
LCD to a specific location of LCD. The
LCD has 2 rows with 16 characters for
each row, this function was set so that
when data is greater to 16, data will
display on second row.
7.4 lcd_clr
Figure 32
Refer to Figure 32, this function is used
for clear the LCD display by configure it
with 0x01.
Figure 29
7.5 send_string
7.2 send_char
Figure 33
Refer to Figure 33, the function is used
for send a string to LCD display.
7.6 send_dec
Figure 30
Figure 30 shows the function to send
character to LCD display. RS=1 is set for
entering write mode. The data needs to
detect one bit by one bit, therefore a loop
with 8 cycles is need for shift the data to
right. e_pulse function is used after the
loop for send the pulse to E pins of LCD.
The E pin is used for start data read and
write.
7.3 lcd_goto
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved
Figure 34
This function is used for display a
decimal on LCD display, “num-dig”
makes user choose the number decimal
place of data need to be shown. Data will
be divided. The remainder will be taken
again for divided. This method is useful
to show the numbers one by one. This
9