Pages

Thursday, May 30, 2013

Guzunty Pi stepping motor function writing notes

I read my old stepping motor functions and found them stupid.  So I wrote a new function.

WaveSequence = [0x1, 0x4, 0x2, 0x8]

def TestSteppingMotor(activationSequence, stepCount, stepTime):

   ...

    spiChannel = spidev.SpiDev() 
    spiChannel.open(0, 0) 

    for step in range(stepCount):
        for activation in activationSequence:
            spiChannel.xfer2([activation])
    time.sleep(stepTime)

  ...

Now I am going to test it.

  

# ftguzuntypi.py v1.2 tlfong01 2013may29

# *****************************************************************************
# Module - ftguzuntypi.py
# Description - LED driver 
# *****************************************************************************

# *****************************************************************************
# Imports
# *****************************************************************************

import time
import spidev
from subprocess import call

import ftspi
import ftprint

# *****************************************************************************
# Guzunty Pi tests functions
# *****************************************************************************

# *****************************************************************************
# Function - Stepping motor
# Description - 
# P1 pin assignment ***
#   P1-01 = Winding 1 (A-)
#   P1-02 = Winding 2 (A+)
#   P1-03 = Winding 3 (B-)
#   P1-04 = Winding 4 (B+) 
# Activation sequences
#   WaveSequence = [1, 3, 2, 4]
#   FullStepSequence =  [[1, 3], [1, 4], [2, 4], [2, 3]]
#   HalfStepSequence =  [[1], [1,4], [4], [2,4], [2], [2,3], [3]] 
# Sample call - 
#   TestSteppingMotor(activationSequence =  [0x1, 0x2, 0x4, 0x8], stepCount = 50, stepTime = 1)
# *****************************************************************************

WaveSequence = [0x1, 0x4, 0x2, 0x8]

def TestSteppingMotor(activationSequence, stepCount, stepTime):

    ftprint.PrintDoubleSpaceLine("*** Start testing stepping motor ***")    

    spiChannel = spidev.SpiDev() 
    spiChannel.open(0, 0) 

    for step in range(stepCount):
        for activation in activationSequence:
            spiChannel.xfer2([activation])
   time.sleep(stepTime)

    spiChannel.close() 

    ftprint.PrintDoubleSpaceLine("*** Stop testing stepping motor ***")


# *****************************************************************************
# Function - 
# Description - 
# Sample call -  
#   ftguzuntypi.TestGuzuntyPi4digit7segmentLedModule(spiChannelNumber = 0, spiChipEnableNumber = 1)
# Sample output -
#   *** Start Program - FongToy v1.0 tlfong01 2013may20  ***
#   Tue May 21 08:43:18 2013
#   Hour   digit 1 =  0
#   Hour   digit 2 =  8
#   Minute digit 1 =  4
#   Minute digit 2 =  3
#   Second digit 1 =  1
#   Second digit 2 =  8
#   hourDoubleDigit 0 =  0
#   hourDoubleDigit 1 =  8
#   minuteDoubleDigit 0 =  4
#   minuteDoubleDigit 1 =  3
#   secondDoubleDigit 0 =  1
#   secondDoubleDigit 1 =  8
#   hour =  0 8
#   minute =  4 3
#   second =  1 8
#   *** Stop Program ***
# ***************************************************************************** 

def SetRpiPin7GpClk0Frequency4688Hz():
    returnCode = call(["gpio mode 7 clock"], shell = True)
    returnCode = call("gpio clock 7 4688", shell=True)

def TestGuzuntyClock(spiChannel, secondCount):

    SetRpiPin7GpClk0Frequency4688Hz()

    # *** 7 segment patterns ***
    #PatternDigit0     = ~0x3f
    #PatternDigit1     = ~0x06
    #PatternDigit2     = ~0x5b
    #PatternDigit3     = ~0x4f
    #PatternSpace      = 0xff
    #PatternAllOn      = 0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternDigit0     = 0x3f
    PatternDigit1     = 0x06
    PatternDigit2     = 0x5b
    PatternDigit3     = 0x4f
    PatternSpace      = ~0xff
    PatternAllOn      = ~0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternListAllOff = [PatternSpace, PatternSpace, PatternSpace, PatternSpace]
    PatternListAllOn  = [PatternAllOn, PatternAllOn, PatternAllOn, PatternAllOn]
    PatternList0123   = [PatternDigit0, PatternDigit1, PatternDigit2, PatternDigit3]
    PatternListGood   = [PatternBigG, PatternSmallO, PatternSmallO, PatternSmallD]     
  
    # *** time digits ***
    timeString =  time.asctime(time.localtime(time.time()))
    print timeString

    print "Hour   digit 1 = ", timeString[11:12]
    print "Hour   digit 2 = ", timeString[12:13]
    print "Minute digit 1 = ", timeString[14:15]
    print "Minute digit 2 = ", timeString[15:16]
    print "Second digit 1 = ", timeString[17:18]
    print "Second digit 2 = ", timeString[18:19]

    hourDoubleDigit = [timeString[11:12], timeString[12:13]]
    print "hourDoubleDigit 0 = ", hourDoubleDigit[0]
    print "hourDoubleDigit 1 = ", hourDoubleDigit[1]

    minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
    print "minuteDoubleDigit 0 = ", minuteDoubleDigit[0]
    print "minuteDoubleDigit 1 = ", minuteDoubleDigit[1]

    secondDoubleDigit = [timeString[17:18], timeString[18:19]]
    print "secondDoubleDigit 0 = ", secondDoubleDigit[0]
    print "secondDoubleDigit 1 = ", secondDoubleDigit[1]

    timeHexDigit = [hourDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "hour = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [minuteDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "minute = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [secondDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "second = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    # *** 4 digit 7-segment LED displays ***    

    ftspi.SpiWrite(spiChannel, PatternListAllOff)
    time.sleep(0.5)

    ftspi.SpiWrite(spiChannel, PatternListAllOn)    
    time.sleep(0.5)

    ftspi.SpiWrite(spiChannel, PatternList0123)    
    time.sleep(1)

    ftspi.SpiWrite(spiChannel, PatternListGood)    
    time.sleep(1)

    # SevenSegmentPatternNumbers = [~0x3f, ~0x06, ~0x5b, ~0x4f, ~0x66, ~0x6d, ~0x7d, ~0x07, ~0x7f, ~0x6f]
    SevenSegmentPatternNumbers = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f]
    
    decimalPoint = 0

    for i in range(secondCount):

        print "Guzunty Clock second count = ", i
        timeString =  time.asctime(time.localtime(time.time()))

        hourDoubleDigit = [timeString[11:12], timeString[12:13]]
        minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
secondDoubleDigit = [timeString[17:18], timeString[18:19]]

        minuteDigit0 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[0])]
        minuteDigit1 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[1])]
        secondDigit0 = SevenSegmentPatternNumbers[int(secondDoubleDigit[0])]
        secondDigit1 = SevenSegmentPatternNumbers[int(secondDoubleDigit[1])]

        if (decimalPoint == 0):
   #minuteDigit1 &= ~0x80
   minuteDigit1 |= 0x80
   decimalPoint = 1
        else:
            decimalPoint = 0

        minuteSecondQuadDigitList = [minuteDigit0, minuteDigit1, secondDigit0, secondDigit1]        
ftspi.SpiWrite(spiChannel, minuteSecondQuadDigitList)            
time.sleep(1)

def TestGuzuntyPiLedDriver00(spiChannel, channelNumber, chipEnableNumber):

    SetRpiPin7GpClk0Frequency4688Hz()
    
    spiGuzuntyPi = spidev.SpiDev() 
    spiGuzuntyPi.open(0, 1)

    # *** 7 segment patterns ***
    #PatternDigit0     = ~0x3f
    #PatternDigit1     = ~0x06
    #PatternDigit2     = ~0x5b
    #PatternDigit3     = ~0x4f
    #PatternSpace      = 0xff
    #PatternAllOn      = 0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternDigit0     = 0x3f
    PatternDigit1     = 0x06
    PatternDigit2     = 0x5b
    PatternDigit3     = 0x4f
    PatternSpace      = ~0xff
    PatternAllOn      = ~0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternListAllOff = [PatternSpace, PatternSpace, PatternSpace, PatternSpace]
    PatternListAllOn  = [PatternAllOn, PatternAllOn, PatternAllOn, PatternAllOn]
    PatternList0123   = [PatternDigit0, PatternDigit1, PatternDigit2, PatternDigit3]
    PatternListGood   = [PatternBigG, PatternSmallO, PatternSmallO, PatternSmallD]     
  
    # *** time digits ***
    timeString =  time.asctime(time.localtime(time.time()))
    print timeString

    print "Hour   digit 1 = ", timeString[11:12]
    print "Hour   digit 2 = ", timeString[12:13]
    print "Minute digit 1 = ", timeString[14:15]
    print "Minute digit 2 = ", timeString[15:16]
    print "Second digit 1 = ", timeString[17:18]
    print "Second digit 2 = ", timeString[18:19]

    hourDoubleDigit = [timeString[11:12], timeString[12:13]]
    print "hourDoubleDigit 0 = ", hourDoubleDigit[0]
    print "hourDoubleDigit 1 = ", hourDoubleDigit[1]

    minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
    print "minuteDoubleDigit 0 = ", minuteDoubleDigit[0]
    print "minuteDoubleDigit 1 = ", minuteDoubleDigit[1]

    secondDoubleDigit = [timeString[17:18], timeString[18:19]]
    print "secondDoubleDigit 0 = ", secondDoubleDigit[0]
    print "secondDoubleDigit 1 = ", secondDoubleDigit[1]

    timeHexDigit = [hourDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "hour = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [minuteDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "minute = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [secondDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "second = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    # *** 4 digit 7-segment LED displays ***    

    spiGuzuntyPi.xfer2(PatternListAllOff)    
    time.sleep(1)

    spiGuzuntyPi.xfer2(PatternListAllOn)    
    time.sleep(1)

    spiGuzuntyPi.xfer2(PatternList0123)    
    time.sleep(2)

    spiGuzuntyPi.xfer2(PatternListGood)    
    time.sleep(2)

    # SevenSegmentPatternNumbers = [~0x3f, ~0x06, ~0x5b, ~0x4f, ~0x66, ~0x6d, ~0x7d, ~0x07, ~0x7f, ~0x6f]
    SevenSegmentPatternNumbers = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f]
    
    decimalPoint = 0

    for i in range(2):
        timeString =  time.asctime(time.localtime(time.time()))

        hourDoubleDigit = [timeString[11:12], timeString[12:13]]
        minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
secondDoubleDigit = [timeString[17:18], timeString[18:19]]

        minuteDigit0 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[0])]
        minuteDigit1 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[1])]
        secondDigit0 = SevenSegmentPatternNumbers[int(secondDoubleDigit[0])]
        secondDigit1 = SevenSegmentPatternNumbers[int(secondDoubleDigit[1])]

        if (decimalPoint == 0):
   #minuteDigit1 &= ~0x80
   minuteDigit1 |= 0x80
   decimalPoint = 1
        else:
            decimalPoint = 0

        minuteSecondQuadDigitList = [minuteDigit0, minuteDigit1, secondDigit0, secondDigit1]
        
spiGuzuntyPi.xfer2(minuteSecondQuadDigitList)    
        
time.sleep(1)


def TestGuzuntyPi4digit7segmentLedModule(spiChannelNumber, spiChipEnableNumber):

    spiChannel = spidev.SpiDev() 
    spiChannel.open(spiChannelNumber, spiChipEnableNumber)

    SetRpiPin7GpClk0Frequency4688Hz()

    # *** 7 segment patterns ***
    #PatternDigit0     = ~0x3f
    #PatternDigit1     = ~0x06
    #PatternDigit2     = ~0x5b
    #PatternDigit3     = ~0x4f
    #PatternSpace      = 0xff
    #PatternAllOn      = 0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternDigit0     = 0x3f
    PatternDigit1     = 0x06
    PatternDigit2     = 0x5b
    PatternDigit3     = 0x4f
    PatternSpace      = ~0xff
    PatternAllOn      = ~0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternListAllOff = [PatternSpace, PatternSpace, PatternSpace, PatternSpace]
    PatternListAllOn  = [PatternAllOn, PatternAllOn, PatternAllOn, PatternAllOn]
    PatternList0123   = [PatternDigit0, PatternDigit1, PatternDigit2, PatternDigit3]
    PatternListGood   = [PatternBigG, PatternSmallO, PatternSmallO, PatternSmallD]     
  
    # *** time digits ***
    timeString =  time.asctime(time.localtime(time.time()))
    print timeString

    print "Hour   digit 1 = ", timeString[11:12]
    print "Hour   digit 2 = ", timeString[12:13]
    print "Minute digit 1 = ", timeString[14:15]
    print "Minute digit 2 = ", timeString[15:16]
    print "Second digit 1 = ", timeString[17:18]
    print "Second digit 2 = ", timeString[18:19]

    hourDoubleDigit = [timeString[11:12], timeString[12:13]]
    print "hourDoubleDigit 0 = ", hourDoubleDigit[0]
    print "hourDoubleDigit 1 = ", hourDoubleDigit[1]

    minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
    print "minuteDoubleDigit 0 = ", minuteDoubleDigit[0]
    print "minuteDoubleDigit 1 = ", minuteDoubleDigit[1]

    secondDoubleDigit = [timeString[17:18], timeString[18:19]]
    print "secondDoubleDigit 0 = ", secondDoubleDigit[0]
    print "secondDoubleDigit 1 = ", secondDoubleDigit[1]

    timeHexDigit = [hourDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "hour = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [minuteDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "minute = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [secondDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "second = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    # *** 4 digit 7-segment LED displays ***    

#    spiGuzuntyPi.xfer2(PatternListAllOff)    
#    time.sleep(1)
#    spiGuzuntyPi.xfer2(PatternListAllOn)    
#    time.sleep(1)
#    spiGuzuntyPi.xfer2(PatternList0123)    
#    time.sleep(2)
#    spiGuzuntyPi.xfer2(PatternListGood)    
#    time.sleep(2)

    ftspi.SpiWrite(spiChannel, PatternListAllOff)
    time.sleep(1)

    ftspi.SpiWrite(spiChannel, PatternListAllOn)    
    time.sleep(1)

    ftspi.SpiWrite(spiChannel, PatternList0123)    
    time.sleep(2)

    ftspi.SpiWrite(spiChannel, PatternListGood)    
    time.sleep(2)

    # SevenSegmentPatternNumbers = [~0x3f, ~0x06, ~0x5b, ~0x4f, ~0x66, ~0x6d, ~0x7d, ~0x07, ~0x7f, ~0x6f]
    SevenSegmentPatternNumbers = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f]
    
    decimalPoint = 0

    for i in range(2):
        timeString =  time.asctime(time.localtime(time.time()))

        hourDoubleDigit = [timeString[11:12], timeString[12:13]]
        minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
secondDoubleDigit = [timeString[17:18], timeString[18:19]]

        minuteDigit0 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[0])]
        minuteDigit1 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[1])]
        secondDigit0 = SevenSegmentPatternNumbers[int(secondDoubleDigit[0])]
        secondDigit1 = SevenSegmentPatternNumbers[int(secondDoubleDigit[1])]

        if (decimalPoint == 0):
   #minuteDigit1 &= ~0x80
   minuteDigit1 |= 0x80
   decimalPoint = 1
        else:
            decimalPoint = 0

        minuteSecondQuadDigitList = [minuteDigit0, minuteDigit1, secondDigit0, secondDigit1]        
ftspi.SpiWrite(spiChannel, minuteSecondQuadDigitList)            
time.sleep(1)


def TestGuzuntyPiLedDriver00(spiChannel, channelNumber, chipEnableNumber):

    SetRpiPin7GpClk0Frequency4688Hz()
    
    spiGuzuntyPi = spidev.SpiDev() 
    spiGuzuntyPi.open(0, 1)

    # *** 7 segment patterns ***
    #PatternDigit0     = ~0x3f
    #PatternDigit1     = ~0x06
    #PatternDigit2     = ~0x5b
    #PatternDigit3     = ~0x4f
    #PatternSpace      = 0xff
    #PatternAllOn      = 0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternDigit0     = 0x3f
    PatternDigit1     = 0x06
    PatternDigit2     = 0x5b
    PatternDigit3     = 0x4f
    PatternSpace      = ~0xff
    PatternAllOn      = ~0x00

    PatternBigG       = 0x3d
    PatternSmallG     = 0x6f
    PatternSmallO     = 0x5c
    PatternSmallD     = 0x5e

    PatternListAllOff = [PatternSpace, PatternSpace, PatternSpace, PatternSpace]
    PatternListAllOn  = [PatternAllOn, PatternAllOn, PatternAllOn, PatternAllOn]
    PatternList0123   = [PatternDigit0, PatternDigit1, PatternDigit2, PatternDigit3]
    PatternListGood   = [PatternBigG, PatternSmallO, PatternSmallO, PatternSmallD]     
  
    # *** time digits ***
    timeString =  time.asctime(time.localtime(time.time()))
    print timeString

    print "Hour   digit 1 = ", timeString[11:12]
    print "Hour   digit 2 = ", timeString[12:13]
    print "Minute digit 1 = ", timeString[14:15]
    print "Minute digit 2 = ", timeString[15:16]
    print "Second digit 1 = ", timeString[17:18]
    print "Second digit 2 = ", timeString[18:19]

    hourDoubleDigit = [timeString[11:12], timeString[12:13]]
    print "hourDoubleDigit 0 = ", hourDoubleDigit[0]
    print "hourDoubleDigit 1 = ", hourDoubleDigit[1]

    minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
    print "minuteDoubleDigit 0 = ", minuteDoubleDigit[0]
    print "minuteDoubleDigit 1 = ", minuteDoubleDigit[1]

    secondDoubleDigit = [timeString[17:18], timeString[18:19]]
    print "secondDoubleDigit 0 = ", secondDoubleDigit[0]
    print "secondDoubleDigit 1 = ", secondDoubleDigit[1]

    timeHexDigit = [hourDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "hour = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [minuteDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "minute = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    timeHexDigit = [secondDoubleDigit, minuteDoubleDigit, secondDoubleDigit]
    print "second = ", (timeHexDigit[0])[0], (timeHexDigit[0])[1]

    # *** 4 digit 7-segment LED displays ***    

    spiGuzuntyPi.xfer2(PatternListAllOff)    
    time.sleep(1)

    spiGuzuntyPi.xfer2(PatternListAllOn)    
    time.sleep(1)

    spiGuzuntyPi.xfer2(PatternList0123)    
    time.sleep(2)

    spiGuzuntyPi.xfer2(PatternListGood)    
    time.sleep(2)

    # SevenSegmentPatternNumbers = [~0x3f, ~0x06, ~0x5b, ~0x4f, ~0x66, ~0x6d, ~0x7d, ~0x07, ~0x7f, ~0x6f]
    SevenSegmentPatternNumbers = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f]
    
    decimalPoint = 0

    for i in range(2):
        timeString =  time.asctime(time.localtime(time.time()))

        hourDoubleDigit = [timeString[11:12], timeString[12:13]]
        minuteDoubleDigit = [timeString[14:15], timeString[15:16]]
secondDoubleDigit = [timeString[17:18], timeString[18:19]]

        minuteDigit0 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[0])]
        minuteDigit1 = SevenSegmentPatternNumbers[int(minuteDoubleDigit[1])]
        secondDigit0 = SevenSegmentPatternNumbers[int(secondDoubleDigit[0])]
        secondDigit1 = SevenSegmentPatternNumbers[int(secondDoubleDigit[1])]

        if (decimalPoint == 0):
   #minuteDigit1 &= ~0x80
   minuteDigit1 |= 0x80
   decimalPoint = 1
        else:
            decimalPoint = 0

        minuteSecondQuadDigitList = [minuteDigit0, minuteDigit1, secondDigit0, secondDigit1]
        
spiGuzuntyPi.xfer2(minuteSecondQuadDigitList)    
        
time.sleep(1)

# .END

# fongtoy v1.28 tlfong01 2013may30

ProgramTitle = "FongToy v1.28 tlfong01 2013may30"

import sys 
import time 
import smbus 
import pdb 
import spidev 
import wiringpi
import wiringpi2
import RPIO as GPIO  
from RPIO import PWM 
from enum import Enum 
from subprocess import call

import ftgpio
import ftprint
import ftspi
import ftiox
import fteeprom
import ftguzuntypi
import ftdemux
import fttest
import ftadc

# *** Troubleshooting functions ***

# *** GPIO tests v1.3 tlfong01 2013may23 ***
# ftgpio.TestLed()
# ftgpio.TestBuzzer()
# ftgpio.TestButtonEchoBuzzer()
# ftgpio.TestButtonEchoLed()

# *** SPI Tests v1.3 tlfong01 2013may23 ***

# ftdemux.TestSelectSpiSlaveDevice(spiChannelNumber = 0, spiChipEnableNumber = 0, spiIoxSubAddress = 0, spiSlaveDeviceNumber = 5)
# fttest.TestDemuxEeprom(mcp23s17SubAddress = 0, eepromDemuxAddress = 2, testStartAddress = 0x0123, testWriteDataByte = 0x5a)
# fttest.TestDemuxEeprom(mcp23s17SubAddress = 0, eepromDemuxAddress = 1, testStartAddress = 0x0123, testWriteDataByte = 0x3b)
# fttest.TestDemuxEeprom(mcp23s17SubAddress = 0, eepromDemuxAddress = 0, testStartAddress = 0x0123, testWriteDataByte = 0x3b)

# ftiox.TestMcp23s17BlinkLed(spiChannelNumber = 0, spiChipEnableNumber = 0, spiChipSubAddress = 0)
# ftdemux.TestSelectSpiSlaveDevice(spiChannelNumber = 0, spiChipEnableNumber = 0, spiIoxSubAddress = 0, spiSlaveDeviceNumber = 5)
# fttest.TestDemuxEeprom(mcp23s17SubAddress = 0, eepromDemuxAddress = 0, testStartAddress = 0x0123, testWriteDataByte = 0x3b)
# fttest.TestDemuxEeprom(mcp23s17SubAddress = 0, eepromDemuxAddress = 1, testStartAddress = 0x0411, testWriteDataByte = 0x4c)
# fttest.TestDemuxGuzuntyClock(mcp23s17SubAddress = 0, guzuntyClockDemuxAddress = 2, secondCount = 10)

# *** Main program ***

# *** Start program message ***
ftprint.StartProgram(ProgramTitle)

# *** Main tests ***

# *** SPI loop back ***
# ftspi.TestSpiLoopBackV01(spiChannelNumber = 0, spiChipEnableNumber = 1, testDataByte = 0x55, testTime = 0.001, testCount = 60000)

# *** ADC ***
# ftadc.TestMcp3208v03() 
# ftadc.TestMcp3201v04()

# *** EEPROM ***
# fteeprom.TestEeporm25Lc256v01(spiChannelNumber = 0, spiChipEnableNumber = 1, startAddress = 0x4100, testDataByte = 0x55)

# *** Mcp23s17 ***
# ftiox.TestMcp23s17BlinkLed(spiChannelNumber = 0, spiChipEnableNumber = 0, spiChipSubAddress = 0)

# *** Demux ***
# ftdemux.TestDemuxV01(spiChannelNumber = 0, spiChipEnableNumber = 0, spiIoxSubAddress = 0, spiSlaveDeviceNumber = 5)

# *** Guzunty Pi ***
# ftguzuntypi.TestGuzuntyPi4digit7segmentLedModule(spiChannelNumber = 0, spiChipEnableNumber = 0) # not yet tested

ftguzuntypi.TestSteppingMotor(activationSequence = ftguzuntypi.WaveSequence, stepCount = 50, stepTime = 1)

# *** Stop program message ***
ftprint.StopProgram()

#.END

.END


No comments:

Post a Comment