GFT2009_2010
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bipolar Stepper motors - Atmega8 - Bascom

Go down

Bipolar Stepper motors - Atmega8 - Bascom Empty Bipolar Stepper motors - Atmega8 - Bascom

Post  abed.oubari Mon Sep 17, 2012 2:28 am

This is a small program in Bascom, to drive a bipolar stepper motor using Atmega8 Controller and L298N:

[img]Bipolar Stepper motors - Atmega8 - Bascom Atmega10[/img]

Bascom Program:


'------------------------------------------------------------------------------
'name : BIPOLAR STEPPER MOTOR - L298N
'copyright : (c) 2012 - CNESTEN - MOROCCO
'purpose : 2 directions driving bipolar steper motor
'micro : AtMega8
'
' By Abed OUBARI
'------------------------------------------------------------------------------
$regfile = "m8def.dat" ' we use the M48
$crystal = 16000000
$baud = 9600

'define pins of Port D and C
Config Portd = Output
Config Pind.2 = Input
Config Pind.3 = Input

Dim I As Byte

Begin:

For I = 0 To 20
Set Portd.4
Set Portd.5
Reset Portd.6
Reset Portd.7
Waitms 7

Reset Portd.4
Set Portd.5
Set Portd.6
Reset Portd.7
Waitms 7

Reset Portd.4
Reset Portd.5
Set Portd.6
Set Portd.7
Waitms 7

Set Portd.4
Reset Portd.5
Reset Portd.6
Set Portd.7
Waitms 7


Next I
For I = 0 To 20
Set Portd.4
Reset Portd.5
Reset Portd.6
Set Portd.7
Waitms 7

Reset Portd.4
Reset Portd.5
Set Portd.6
Set Portd.7
Waitms 7

Reset Portd.4
Set Portd.5
Set Portd.6
Reset Portd.7
Waitms 7

Set Portd.4
Set Portd.5
Reset Portd.6
Reset Portd.7
Waitms 7

Next I
Wait 3

Goto Begin

End
abed.oubari
abed.oubari
Admin

Posts : 77
Join date : 2010-02-25
Age : 45
Location : Morocco

https://gft2009.forumactif.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum