Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Yes, it needs to control an H-bridge. ANd to do that you will need to generate PWM signals from your microcontroller somehow either with the built-in hardware, or bit blasting if the MCU does not have an output compare or PWM module.
As you've checked my tutorials, look at the PWM one - which gives 128 speeds either forwards or backwards for two motors. As dknguyen says, you also need an h-bridge to feed the motor, and if you want to use two motors (like for a robot), a 16F628 isn't enough, and my tutorial uses a 16F876 for that reason.
I have designed the following circuit ...**broken link removed** - The last circuit from the bottom and works but when it comes to code?I do not know. I read your tutorial and seem to understand but for my implementation it is tricky. I was going to send the bytes with this utility ..Pololu - Pololu Serial Transmitter utility for Windows - serial transmitter and turn on an LED from one of the output pin e.g RA0 before connecting the entire H-bridge.
I am trying speed control, forward, reverse and stop. My intent is send byte 1 - preamble all ones, byte 2 - address of motor, byte 3 - direction and speed(crucial one) and byte 4 - error detection.
I am going back to visit your site to study your tutorials again and see what I will come with.
From the sound of it you're wanting to do this via radio?, so my Manchester radio routines (using a two byte packet) and the PWM tutorial could easily be joined together.
I have been reading and referencing from Nigel tutorials and would like to know where am I making a mistake?
LIST p=16F628 ;tell assembler what chip we are using
include "P16F628.inc" ;include the defaults for the chip
ERRORLEVEL 0, -302 ;suppress bank selection messages
__config 0x3D18 ;sets the configuration settings (oscillator)
cblock 0x20 ;start of general purpose registers
count
KM Equ 0
org 0x0000
movlw 0x07
movwf CMCON ;turn comparators off
Initialise clrf count
clrf PORTA
clrf PORTB
SetPorts bsf STATUS, RP0 ;select bank 1
MOVLW B'00000110'
MOVWF TRISB
bcf STATUS, RP0 ;select bank 0
call SER_INIT
CHECK call Rcv_RS232 ;check receive data
xorlw 'B'
btfss STATUS, Z ;is data 'B'?
goto CHECK ;if not, goto CHECK
goto KM_ON ;if yes. goto KM_ON
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.