Stepper motor with L293B and pic16f648A


Results 1 to 4 of 4

Threaded View

  1. #2
    Join Date
    Sep 2006
    Location
    Mexico
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    Hello, try with this modified code:

    Code:
    DEFINE OSC 4    'Change it for your osc
    DEFINE ADC_CLOCK 3
    steps var word
    stepArray var byte(4)
    x var byte
    
    CMCON = 7
    TRISA = %00000011   'Porta.0 and porta.1 as input
    TRISB = %00000000   'Portb as output, 0=Output, 1=Input
    PORTB = 0
    x=0
    'input porta.0      ' You dont need this, just TRISA command
    'input porta.1
    stepArray[0] = %00001010
    stepArray[1] = %00000110
    stepArray[2] = %00000101
    stepArray[3] = %00001001
    
    pause 500
    
    main:
    if porta.1 = 1 then
         for x=0 to 3
    PORTB = stepArray[x]
    pause 20 'Change it for diferent speed
    next x
    endif
    
    if porta.0 = 1 then
    
    for x=0 to 3
    PORTB = stepArray[3-x]
    pause 20  'Change it for diferent speed
    next x
    endif
    
    
    
    goto main
    Last edited by Raflex; - 31st March 2008 at 01:41.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts