Uncategorized

PCF8591 ADC / DAC Programmng Notes V0.1

PCF8591 ADC / DAC Programming Note V0.1

pcf9685_2019nov2801


# fadc145.py tlfong01 2019nov27hkt1411

import os
import smbus
from time import sleep
from datetime import datetime
import fprint70 as fprint
import ftime73 as ftime
import fi2c140 as fi2c

# *** PCF8591 ADC/DAC Module Config ***

pcf8591ControlByteDict = {
'ChannelNum0': 0x00,
'ChannelNum1': 0x01,
}

pcf8591DevAddrDict = {
'DevAddr0': 0x48,
'DevAddr1': 0x49,
'DevAddr2': 0x4a,
'DevAddr3': 0x4b,
'DevAddr4': 0x4c,
'DevAddr5': 0x4d,
'DevAddr6': 0x4e,
'DevAddr7': 0x4f,
}

pcf8591AdcPhMeterModuleDict = {
'PhMeter': {'ḾoduleName': 'PhMeter',
'ModuleHelp': 'PhMeterHelp',

'GreenTea': {'SignalName' : 'GreenTea',
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr0',
'ChannelNumName' : 'ChannelNum0',
},

'Milk' : {'SignalName' : 'Milk',
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr1',
'ChannelNumName': 'ChannelNum0',
},
'Water' : {'SignalName' : 'Water',
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr7',
'ChannelNumName': 'ChannelNum0',
},

'Oil' : {'SignalName' : 'Oil', 
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr6',
'ChannelNumName': 'ChannelNum0',
} 
},
}

# *** System Info ***

def systemInfo():
print('\n# *** UART BaudRate *****************************************************') 
os.system('grep dtparam=i2c /boot/config.txt')
return 

# *** Read PCF8591 Single Ended Input Channel 0 ***

def readAdcResults(i2cBus, devAddr, controlByte):
adcResults = i2cBus.read_byte_data(devAddr, controlByte)
adcResults = i2cBus.read_byte_data(devAddr, controlByte)
return adcResults

def pcf8591Convert(moduleName, signalName):
# fprint.printBeginExecFunction()

i2cBusName = pcf8591AdcPhMeterModuleDict[moduleName][signalName]['I2cBusName']
devAddrName = pcf8591AdcPhMeterModuleDict[moduleName][signalName]['DevAddrName']
channelNumName = pcf8591AdcPhMeterModuleDict[moduleName][signalName]['ChannelNumName']

i2cBus = fi2c.i2cBusDict[i2cBusName]
devAddr = pcf8591DevAddrDict[devAddrName]
controlByte = pcf8591ControlByteDict[channelNumName]

adcResults = readAdcResults(i2cBus, devAddr, controlByte)

#print('\n# *** PCF8591 ADC Testing *****************************************************\n')
#fprint.printTitleString('Module Name', fprint.indentFormat640, moduleName)
#fprint.printTitleString('Signal Name', fprint.indentFormat640, signalName)

#fprint.printTitleString('I2C Bus Name', fprint.indentFormat640, i2cBusName)
#fprint.printTitleOneByteNum('PCF8591 I2C Device Addr', fprint.indentFormat640, devAddr)
#fprint.printTitleOneByteNum('Channel Number', fprint.indentFormat640, pcf8591ControlByteDict[channelNumName])

#print('\n ADC Results =', fprint.convertOneByteNumToFourCharStr(adcResults), ' (hex)')
print(' =', (str(adcResults)).ljust(4, ' '), ' (dec)')
print(' =', (str(int((float((adcResults)/255) * 100)))).ljust(4, ' '), ' (%)')

# fprint.printEndExecFunction()
return

# ********************************************************************************
# *** I2C PCF8591 ADC PhMeter GreenTea/Milk/Water Tests ***
# ********************************************************************************

def convertPhMeterGreenTea():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'GreenTea')
#fprint.printEndExecFunction()
return

def convertPhMeterMilk():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'Milk')
#fprint.printEndExecFunction()
return

def convertPhMeterWater():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'Water')
#fprint.printEndExecFunction()
return

def convertPhMeterOil():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'Oil')
#fprint.printEndExecFunction()
return

# *** pcfAdcPhMeter Test function Dict ***

pcf8591AdcPhMeter = {
'GreenTea' : convertPhMeterGreenTea,
'Milk' : convertPhMeterMilk,
'Water' : convertPhMeterWater,
'Oil' : convertPhMeterOil,
}

# ********************************************************************************
# *** Init/Main Functions ***
# ********************************************************************************

# *** Init Function ***

def init():
pass
return

# ********************************************************************************
#*** Main Function ***
# ********************************************************************************

def main():
init()
print('GreenTea')
pcf8591AdcPhMeter['GreenTea']()
print('Milk')
pcf8591AdcPhMeter['Milk']()
print('Water')
pcf8591AdcPhMeter['Water']()
print('Oil')
pcf8591AdcPhMeter['Oil']()
return

# ********************************************************************************
# *** Main ***
# ********************************************************************************

if __name__ == '__main__':
main()

# *** End of Program ***

'''
Sample OUtput 2019nov28hkt1241
Input config - connect Channel 0 of all 4 modules to (1) about 1.87V(65%), (2) 3.3V, (3) 0V.

Python 3.7.3 (/usr/bin/python3)
>>> %cd /home/pi/Python_Programs/work1422
>>> %Run fadc144.py
= 165 (dec)
= 64 (%)
= 166 (dec)
= 65 (%)
= 165 (dec)
= 64 (%)
= 166 (dec)
= 65 (%)
>>>

---
>>> %Run fadc144.py
= 255 (dec)
= 100 (%)
= 255 (dec)
= 100 (%)
= 255 (dec)
= 100 (%)
= 255 (dec)
= 100 (%)
>>>

---

>>> %Run fadc144.py
= 0 (dec)
= 0 (%)
= 1 (dec)
= 0 (%)
= 1 (dec)
= 0 (%)
= 1 (dec)
= 0 (%)
>>>


'''




# fi2c140.py tlfong01 2019nov25hkt1136

from time import sleep
from datetime import datetime
from signal import pause
import smbus
import fprint70 as fprint
import ftime73 as ftime
import os

# I2c Bus Setup Notes

# *** Date and Configuration ***
# pi@raspberrypi:~ $ date Wed 28 Aug 2019 03:26:24 PM HKT
# pi@raspberrypi:~ $ uname -a
# Linux raspberrypi 4.19.58-v7l+ #1245 SMP Fri Jul 12 17:31:45 BST 2019 armv7l GNU/Linux

# *** Setup multiple I2C buses ***
# pi@raspberrypi:~ $ sudo nano /boot/config.txt

# dtoverlay=i2c1,pins_2_3 (board pins 3, 5)
# dtoverlay=i2c3,pins_4_5 (board pins 7, 29)
# dtoverlay=i2c4,pins_6_7 (board pins 31, 26)
# dtoverlay=i2c5,pins_12_13 (board pins 32, 33)
# dtoverlay=i2c6,pins_22_23 (board pins 15, 16)

# pi@raspberrypi:~ $ ls /dev/i2c*
# /dev/i2c-1 /dev/i2c-3 /dev/i2c-4 /dev/i2c-5 /dev/i2c-6

# *** Speed setting (Only for Rpi4B, Not for Rpi3B+, whose I2C is NOT changeable ***
# pi@raspberrypi:~ $ sudo nano /boot/config.txt

# dtparam=i2c_arm=on, i2c_arm_baudrate=10000

# ********************************************************************************
# ********************************************************************************

# *** I2c Bus Config ***

i2cBus1 = smbus.SMBus(1) 
i2cBus3 = smbus.SMBus(3)
i2cBus4 = smbus.SMBus(4)
# i2cBus5 = smbus.SMBus(5) # <<< not working !!!
i2cBus6 = smbus.SMBus(6)

i2cBusDict = {'I2cBus1': i2cBus1,
'I2cBus3': i2cBus3,
'I2cBus4': i2cBus4,
#'I2cBus5': i2cBus5, # <<<<< Not working !!!
'I2cBus6': i2cBus6,
}

# *** Control Byte Dictionary ***

testControlByteDict = {
'TenMilliSeconds' : 0.01,
'FourTimes' : 4,
'OneMillionTimes' : 1000000,
}

# ********************************************************************************
# ********************************************************************************

# *** Read Write Print Device/Register Functions ***

# *** Write/Read Device One Byte ***

def quickWriteDevOneByte(i2cBus, devAddr, writeByte):
i2cBus.write_byte(devAddr, writeByte)
return

def quickReadDevOneByte(i2cBus, devAddr):
readByte = i2cBus.read_byte(devAddr)
return readByte

# *** Write/Read/Print Device Two Bytes / Device Register One Byte ***

def writeDevTwoBytes(i2cBus, devAddr, writeByte1, writeByte2):
i2cBus.write_byte_data(devAddr, writeByte1, writeByte2)
return

def writeRegOneByte(i2cBus, devAddrDict, devAddrName, regAddrDict, regName, writeByte):
devAddr = devAddrDict[devAddrName]
regAddr = regAddrDict[regName]
writeDevTwoBytes(i2cBus, devAddr, regAddr, writeByte)
return

def readDevOneByte(i2cBus, devAddrAddr, readByteAddr):
readByte = i2cBus.read_byte_data(devAddr, readByteAddr)
return readByte

def readDevReadByteAddrByteOneByte(i2cBus, devAddrAddr, readByteAddr): # !!! Not Tested !!!
readByte = readDevOneByte(i2cBus, devAddrAddr, readByteAddr)
return readByte

def readDevControlByteOneByte(i2cBus, devAddr, controlByte):
readByte = i2cBus.read_byte_data(devAddr, controlByte)
return readByte

def readRegOneByte(i2cBus, devAddrDict, devName, regAddrDict, regName):
devAddr = devAddrDict[devName]
regAddr = regAddrDict[regName]
readByte = i2cBus.read_byte_data(devAddr, regAddr)
return readByte

def printRegOneByte(i2cBus, devAddrDict, devName, regAddrDict, regName):
readByte = readRegOneByte(i2cBusName, devAddrDict, devName, regAddrDict, regName)
print(printTitle, hex(readByte))
return

# *** Write Device Three Bytes ***

def writeDevThreeBytes(i2cBus, devAddr, WriteByte1, writeByte2, writByte3): # <<<<<<<<<< Not yet tested <<<<<<<<<<
i2cBus.write_block_data(devAddr, writeByte1, [writeByte2, writeByte3])
return

# *** OS Info ***

def osInfo():
print('\n# *** System Info *****************************************************')

print('\n>>>>> ', 'Date', '<<<<<')
os.system('date')

print('\n>>>>> ', 'buster version, Rpi4B model, Rpi4B memory', '<<<<<')
os.system('uname -a')
os.system('grep Model /proc/cpuinfo')
os.system('grep MemTotal /proc/meminfo')

print('\n>>>>> ', 'i2c baudrate', '<<<<<')
os.system('grep dtparam=i2c /boot/config.txt')

print('\n>>>>> ', 'i2c dtoverlay', '<<<<<')
os.system('grep dtoverlay=i2c /boot/config.txt')
print('\n>>>>> ', 'ls /dev/i2c*', '<<<<<') 
os.system('ls /dev/i2c*')
i2cdetectCommand = 'i2cdetect -y 1'
print('\n>>>>> ', i2cdetectCommand, '<<<<<')
os.system(i2cdetectCommand)
i2cdetectCommand = 'i2cdetect -y 3'
print('\n>>>>> ', i2cdetectCommand, '<<<<<')
os.system(i2cdetectCommand)
i2cdetectCommand = 'i2cdetect -y 4'
print('\n>>>>> ', i2cdetectCommand, '<<<<<')
os.system(i2cdetectCommand) 
return

# *** Main Test Function ***

# *** PCA9685 16 Ch PWM Controller Config ***

pca9685DevAddrDict = {
'Dev0': 0x40,
'Dev1': 0x41,
'Dev2': 0x40,
'Dev3': 0x43,
'Dev4': 0x44,
'Dev5': 0x45,
'Dev6': 0x46,
'Dev7': 0x47,
}

pca9685RegAddrDict = { 'Mode1': 0x00,
'Mode2': 0x01,
}

pca9685DataByteDict = {
'Mode1Reset': 0x11, 
}

# *** PCF8591 ADC/DAC Config ***

pcf8591DevAddrDict = {
'DevAddr0': 0x48,
'DevAddr1': 0x49,
'DevAddr2': 0x4a,
'DevAddr3': 0x4b,
'DevAddr4': 0x4c,
'DevAddr5': 0x4d,
'DevAddr6': 0x4e,
'DevAddr7': 0x4f,
}

pcf8591ControlByteDict = {
'ChannelNum0': 0x00,
'ChannelNum1': 0x01,
}
pcf8591ModuleDict = {
'PhMeter': {'ḾoduleName': 'PhMeter',
'ModuleHelp': 'PhMeterHelp',

'GreenTea': {'SignalName' : 'GreenTea',
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr0',
'ChannelNumName' : 'ChannelNum0',
},

'Milk' : {'SignalName' : 'Yvalue',
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr1',
'ChannelNumName': 'ChannelNum0',
},
'Water' : {'SignalName' : 'Yvalue',
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr0',
'ChannelNumName': 'ChannelNum0',
},

'Oil' : {'SignalName' : 'Yvalue', 
'I2cBusName' : 'I2cBus4',
'DevAddrName' : 'DevAddr1',
'ChannelNumName': 'ChannelNum0',
} 
},
}

# *** Test PCA9685 ***

def testWriteReadRegister(devId, busName, devName, regName, testByteHexString):
fprint.printBeginExecFunction()

devAddrDict = pca9685DevAddrDict
regAddrDict = pca9685RegAddrDict

i2cBus = i2cBusDict[busName]
testByte = int(testByteHexString, 16)

writeRegOneByte(i2cBus, devAddrDict, devName, regAddrDict, regName, testByte)
readByte = readRegOneByte(i2cBus, devAddrDict, devName, regAddrDict, regName) 

if readByte == testByte:
resultsString = 'Good'
else:
resultsString = 'Bad'

devAddr = devAddrDict[devName]

fprint.printTitleString('Date Time', fprint.indentFormat640, str(datetime.now())[0:16])
fprint.printTitleString('Device Id', fprint.indentFormat640, devId)
fprint.printTitleString('I2C Bus Name', fprint.indentFormat640, busName)
fprint.printTitleString('Device Name', fprint.indentFormat640, devName)
fprint.printTitleOneByteNum('Device Address', fprint.indentFormat640, devAddr)
fprint.printTitleString('Register Name', fprint.indentFormat640, regName)
fprint.printTitleOneByteNum('Register Written', fprint.indentFormat640, testByte) 
fprint.printTitleOneByteNum('Register Read Back', fprint.indentFormat640, readByte) 
fprint.printTitleString('Results', fprint.indentFormat640, resultsString)

fprint.printEndExecFunction()
return

# Notes
# For Mode1 register, Test byte 0x88, 0x77 returns 0x58, 0x77. In other words, some bits are hardwired.

def testRepeatWriteReadRegisterNoPrintResults(devId, busName, devName, regName, testByteHexString, pauseBetweenPingSecondsName, repeatCountName):
fprint.printBeginExecFunction()

devAddrDict = pca9685DevAddrDict
regAddrDict = pca9685RegAddrDict

i2cBus = i2cBusDict[busName]
testByte = int(testByteHexString, 16)

repeatCount = testControlByteDict[repeatCountName]
pauseBetweenPingSeconds = testControlByteDict[pauseBetweenPingSecondsName]

fprint.printTitleString('Repeat Ping Times', fprint.indentFormat640, repeatCount)
fprint.printTitleString('Now repeat pinging, Ctrl-X to exit,', fprint.indentFormat640, '.....') 

pause()

for count in range(repeatCount): # *** Repeat Ping Section ***
writeRegOneByte(i2cBus, devAddrDict, devName, regAddrDict, regName, testByte)
readByte = readRegOneByte(i2cBus, devAddrDict, devName, regAddrDict, regName)
sleep(pauseBetweenPingSeconds)

if readByte == testByte:
resultsString = 'Good'
else:
resultsString = 'Bad' 

fprint.printTitleString('Repeat Ping Times', fprint.indentFormat640, repeatCount)

devAddr = devAddrDict[devName]

fprint.printTitleString('Date Time', fprint.indentFormat640, str(datetime.now())[0:16])
fprint.printTitleString('Device Id', fprint.indentFormat640, devId)
fprint.printTitleString('I2C Bus Name', fprint.indentFormat640, busName)
fprint.printTitleString('Device Name', fprint.indentFormat640, devName)
fprint.printTitleOneByteNum('Device Address', fprint.indentFormat640, devAddr)
fprint.printTitleString('Register Name', fprint.indentFormat640, regName)
fprint.printTitleOneByteNum('Register Written', fprint.indentFormat640, testByte) 
fprint.printTitleOneByteNum('Register Read Back', fprint.indentFormat640, readByte) 
fprint.printTitleString('Results', fprint.indentFormat640, resultsString)

fprint.printEndExecFunction()
return


# *** Test PCF8591 ***

# *** Read PCF8591 Single Ended Input Channel 0 ***

#def readAdcResults(i2cBus, devAddr, controlByte):
# adcResults = i2cBus.read_byte_data(devAddr, controlByte)
# adcResults = i2cBus.read_byte_data(devAddr, controlByte)
# return adcResults

def pcf8591Convert(moduleName, signalName):
# fprint.printBeginExecFunction()

i2cBusName = pcf8591ModuleDict[moduleName][signalName]['I2cBusName']
devAddrName = pcf8591ModuleDict[moduleName][signalName]['DevAddrName']
channelNumName = pcf8591ModuleDict[moduleName][signalName]['ChannelNumName']

i2cBus = i2cBusDict[i2cBusName]
devAddr = pcf8591DevAddrDict[devAddrName]
controlByte = pcf8591ControlByteDict[channelNumName]

# adcResults = readAdcResults(i2cBus, devAddr, controlByte)
adcResults = readDevControlByteOneByte(i2cBus, devAddr, controlByte)
adcResults = readDevControlByteOneByte(i2cBus, devAddr, controlByte)

print('\n# *** PCF8591 ADC Testing *****************************************************\n')
fprint.printTitleString('Module Name', fprint.indentFormat640, moduleName)
fprint.printTitleString('Signal Name', fprint.indentFormat640, signalName)

fprint.printTitleString('I2C Bus Name', fprint.indentFormat640, i2cBusName)
fprint.printTitleOneByteNum('PCF8591 I2C Device Addr', fprint.indentFormat640, devAddr)
fprint.printTitleOneByteNum('Channel Number', fprint.indentFormat640, pcf8591ControlByteDict[channelNumName])

print(' ADC Results =', fprint.convertOneByteNumToFourCharStr(adcResults), ' (hex)')
print(' =', (str(adcResults)).ljust(4, ' '), ' (dec)')
print(' =', (str(int((float((adcResults)/255) * 100)))).ljust(4, ' '), ' (%)')

# fprint.printEndExecFunction()
return

# ********************************************************************************
# ********************************************************************************

# ********************************************************************************
# *** I2C PCF8591 ADC PhMeter GreenTea/Milk/Water Tests ***
# ********************************************************************************

def convertPhMeterGreenTea():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'GreenTea')
#fprint.printEndExecFunction()
return

def convertPhMeterMilk():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'Milk')
#fprint.printEndExecFunction()
return

def convertPhMeterWater():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'Water')
#fprint.printEndExecFunction()
return

def convertPhMeterOil():
#fprint.printBeginExecFunction()
pcf8591Convert('PhMeter', 'Oil')
#fprint.printEndExecFunction()
return 

# ********************************************************************************
# *** Main Tests ***
# ********************************************************************************

def mainTest01(): # *** Testing dateTime and timeElapse Functions ***
ftime.testPrintDateTimeNow()
ftime.testPrintOneSecondElapsedTime()
return

def mainTest02(): # *** Testing I2C PCA9685 16 Channel PWM Controller Ping (ReadAfterWrite Function ) *** 
testWriteReadRegister('PCA9685', 'I2cBus1', 'Dev0', 'Mode1', "0x75") # 0x40
testWriteReadRegister('PCA9685', 'I2cBus1', 'Dev1', 'Mode1', "0x77") # 0x41
testWriteReadRegister('PCA9685', 'I2cBus3', 'Dev2', 'Mode1', "0x77") # 0x40
testWriteReadRegister('PCA9685', 'I2cBus3', 'Dev2', 'Mode1', "0x77") # 0x42
return

def mainTest03():
osInfo() 
convertPhMeterGreenTea()
convertPhMeterMilk()
convertPhMeterWater()
convertPhMeterOil()
return

def mainTest04(): # *** Ping PCA9685 I2cBus1, Device Address 0x40, Register Mode1, Test Byte 0x75 ***
osInfo()
testWriteReadRegister('PCA9685', 'I2cBus1', 'Dev0', 'Mode1', '0x75') # 0x40
return

def mainTest05():
osInfo()
testRepeatWriteReadRegisterNoPrintResults('PCA9685', 'I2cBus1', 'Dev0', 'Mode1', '0x75', 'TenMilliSeconds', 'FourTimes')
testRepeatWriteReadRegisterNoPrintResults('PCA9685', 'I2cBus1', 'Dev0', 'Mode1', '0x75', 'TenMilliSeconds', 'OneMillionTimes')
return

def mainTest06():
osInfo()
convertPhMeterGreenTea()
convertPhMeterMilk()
convertPhMeterWater()
convertPhMeterOil()
return

# ********************************************************************************
# ********************************************************************************

# ********************************************************************************
# *** Init/Main Functions ***
# ********************************************************************************

# *** Init Function ***

def init():
pass
return

# ********************************************************************************
#*** Main Function ***
# ********************************************************************************

def main():
init()
#mainTest01()
#mainTest02()
#mainTest03()
#mainTest04()
#mainTest05()
mainTest06()
return

# ********************************************************************************
# ********************************************************************************

# ********************************************************************************
# *** Main ***
# ********************************************************************************

if __name__ == '__main__':
main()

# *** End of Program ***

# ********************************************************************************
# ********************************************************************************

''' *** Sample Output 2019nov21hkt1310 *******************************************

Python 3.7.3 (/usr/bin/python3)
>>> %Run fi2c127.py

# *** System Info *****************************************************

>>>>> Date <<<<<
Thu 21 Nov 2019 01:09:42 PM HKT

>>>>> buster version, Rpi4B model, Rpi4B memory <<<<<
Linux tlfong01 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
Model : Raspberry Pi 4 Model B Rev 1.1
MemTotal: 1986020 kB

>>>>> i2c baudrate <<<<<
dtparam=i2c_arm=on,i2c_arm_baudrate=500000

>>>>> i2c dtoverlay <<<<<
dtoverlay=i2c1,pins_2_3
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c4,pins_6_7
dtoverlay=i2c5,pins_12_13
dtoverlay=i2c6,pins_22_23

>>>>> ls /dev/i2c* <<<<<
/dev/i2c-1
/dev/i2c-3
/dev/i2c-4
/dev/i2c-6

>>>>> i2cdetect -y 1 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 41 -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- 72 -- -- -- -- --

>>>>> i2cdetect -y 3 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- 42 -- -- -- -- -- 48 49 -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --

>>>>> i2cdetect -y 4 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

********************************************************************************

Begin Execute Function testRepeatWriteReadRegisterNoPrintResults 2019-11-21 13:09

Function Name = testRepeatWriteReadRegisterNoPrintResults
Repeat Ping Times = 4
Now repeat pinging, Ctrl-X to exit, = .....
Repeat Ping Times = 4
Date Time = 2019-11-21 13:09
Device Id = PCA9685
I2C Bus Name = I2cBus1
Device Name = Dev0
Device Address = 0x40
Register Name = Mode1
Register Written = 0x75
Register Read Back = 0x75
Results = Good

End Execute Function testRepeatWriteReadRegisterNoPrintResults 2019-11-21 13:09

********************************************************************************


********************************************************************************

Begin Execute Function testRepeatWriteReadRegisterNoPrintResults 2019-11-21 13:09

Function Name = testRepeatWriteReadRegisterNoPrintResults
Repeat Ping Times = 1000000
Now repeat pinging, Ctrl-X to exit, = .....

'''

''' *** Sample Output 2019nov19hkt2059 *******************************************

>>> %Run fi2c123.py

# *** System Info *****************************************************

>>>>> Date <<<<<
Tue 19 Nov 2019 09:49:15 PM HKT

>>>>> buster version, Rpi4B model, Rpi4B memory <<<<<
Linux tlfong01 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
Model : Raspberry Pi 4 Model B Rev 1.1
MemTotal: 1986020 kB

>>>>> i2c baudrate <<<<<
dtparam=i2c_arm=on,i2c_arm_baudrate=500000

>>>>> i2c dtoverlay <<<<<
dtoverlay=i2c1,pins_2_3
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c4,pins_6_7
dtoverlay=i2c5,pins_12_13
dtoverlay=i2c6,pins_22_23

>>>>> ls /dev/i2c* <<<<<
/dev/i2c-1
/dev/i2c-3
/dev/i2c-4
/dev/i2c-6

>>>>> i2cdetect -y 1 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 41 -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- 72 -- 74 -- -- --

>>>>> i2cdetect -y 3 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- 42 -- -- -- -- -- 48 49 -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- 72 -- 74 -- -- --

>>>>> i2cdetect -y 4 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = GreenTea
I2C Bus Name = I2cBus1
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0xf8 (hex)
= 248 (dec)
= 97 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Milk
I2C Bus Name = I2cBus3
PCF8591 I2C Device Addr = 0x49
Channel Number = 0x00
ADC Results = 0x00 (hex)
= 0 (dec)
= 0 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Water
I2C Bus Name = I2cBus3
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0x7a (hex)
= 122 (dec)
= 47 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Oil
I2C Bus Name = I2cBus4
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0x7b (hex)
= 123 (dec)
= 48 (%)
>>> 
'''


'''
# *** Sample Output 2019nov21hkt1131 ***

Python 3.7.3 (/usr/bin/python3)
>>> %cd /home/pi/Python_Programs/work1409
>>> %Run fi2c125.py

# *** System Info *****************************************************

>>>>> Date <<<<<
Thu 21 Nov 2019 11:29:06 AM HKT

>>>>> buster version, Rpi4B model, Rpi4B memory <<<<<
Linux tlfong01 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
Model : Raspberry Pi 4 Model B Rev 1.1
MemTotal: 1986020 kB

>>>>> i2c baudrate <<<<<
dtparam=i2c_arm=on,i2c_arm_baudrate=500000

>>>>> i2c dtoverlay <<<<<
dtoverlay=i2c1,pins_2_3
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c4,pins_6_7
dtoverlay=i2c5,pins_12_13
dtoverlay=i2c6,pins_22_23

>>>>> ls /dev/i2c* <<<<<
/dev/i2c-1
/dev/i2c-3
/dev/i2c-4
/dev/i2c-6

>>>>> i2cdetect -y 1 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 41 -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --

>>>>> i2cdetect -y 3 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- 42 -- -- -- -- -- 48 49 -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --

>>>>> i2cdetect -y 4 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = GreenTea
I2C Bus Name = I2cBus1
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0xf8 (hex)
= 248 (dec)
= 97 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Milk
I2C Bus Name = I2cBus3
PCF8591 I2C Device Addr = 0x49
Channel Number = 0x00
ADC Results = 0x00 (hex)
= 0 (dec)
= 0 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Water
I2C Bus Name = I2cBus3
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0x7a (hex)
= 122 (dec)
= 47 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Oil
I2C Bus Name = I2cBus4
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0x79 (hex)
= 121 (dec)
= 47 (%)
>>> %Run fi2c125.py

# *** System Info *****************************************************

>>>>> Date <<<<<
Thu 21 Nov 2019 11:29:36 AM HKT

>>>>> buster version, Rpi4B model, Rpi4B memory <<<<<
Linux tlfong01 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
Model : Raspberry Pi 4 Model B Rev 1.1
MemTotal: 1986020 kB

>>>>> i2c baudrate <<<<<
dtparam=i2c_arm=on,i2c_arm_baudrate=500000

>>>>> i2c dtoverlay <<<<<
dtoverlay=i2c1,pins_2_3
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c4,pins_6_7
dtoverlay=i2c5,pins_12_13
dtoverlay=i2c6,pins_22_23

>>>>> ls /dev/i2c* <<<<<
/dev/i2c-1
/dev/i2c-3
/dev/i2c-4
/dev/i2c-6

>>>>> i2cdetect -y 1 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 41 -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --

>>>>> i2cdetect -y 3 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- 42 -- -- -- -- -- 48 49 -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --

>>>>> i2cdetect -y 4 <<<<<
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = GreenTea
I2C Bus Name = I2cBus1
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0xe0 (hex)
= 224 (dec)
= 87 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Milk
I2C Bus Name = I2cBus3
PCF8591 I2C Device Addr = 0x49
Channel Number = 0x00
ADC Results = 0x00 (hex)
= 0 (dec)
= 0 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Water
I2C Bus Name = I2cBus3
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0x7a (hex)
= 122 (dec)
= 47 (%)

# *** PCF8591 ADC Testing *****************************************************

Module Name = PhMeter
Signal Name = Oil
I2C Bus Name = I2cBus4
PCF8591 I2C Device Addr = 0x48
Channel Number = 0x00
ADC Results = 0x79 (hex)
= 121 (dec)
= 47 (%)
>>>


'''

# ftime73.py tlfong01 2019nov26hkt2022
# Rpi4B buster 2019sep26 python 3.7.3 Thronny 3.2

import inspect
from time import sleep
from datetime import datetime
import fprint70 as fprint

# ********************************************************************************
# ********************************************************************************

# *** Date Time Functions ***

def delaySeconds(secondsNum):
sleep(secondsNum)
return

def oneSecondDelay():
delaySeconds(1)
return

def tenMillionPasses():
totalCount = 10000000
for count in range(totalCount):
pass
return

def oneMillionPasses():
totalCount = 1000000
for count in range(totalCount):
pass
return

def oneThousandPasses():
totalCount = 1000
for count in range(totalCount):
pass
return

def printDateTimeNow():
timeNowLong = datetime.now()
timeNowShort = str(timeNowLong)[0:16]
fprint.printTitleString('timeNowLong', fprint.indentFormat640, timeNowLong)
fprint.printTitleString('timeNowShort', fprint.indentFormat640, timeNowShort)
return

def printStartTimeFinishTimeDifferenceLong(startTime, finishTime): 
elapsedTime = finishTime - startTime
elapsedSeconds = elapsedTime.seconds
elapsedMicroSeconds = (elapsedSeconds * 1000000) + elapsedTime.microseconds
elapsedMilliSeconds = int(elapsedMicroSeconds / 1000)
fprint.printTitleString('Start Time', fprint.indentFormat640, startTime)
fprint.printTitleString('Finish Time', fprint.indentFormat640, finishTime)
fprint.printTitleString('Elapsed Time', fprint.indentFormat640, elapsedTime) 
fprint.printTitleString('Elapsed Seconds', fprint.indentFormat640, elapsedSeconds) 
fprint.printTitleString('Elapsed MilliSeconds', fprint.indentFormat640, elapsedMilliSeconds)
fprint.printTitleString('Elapsed MicroSeconds', fprint.indentFormat640, elapsedMicroSeconds) 
return

def printStartTimeFinishTimeDifferenceMilliSeconds(startTime, finishTime): 
elapsedTime = finishTime - startTime
elapsedSeconds = elapsedTime.seconds
elapsedMicroSeconds = (elapsedSeconds * 1000000) + elapsedTime.microseconds
elapsedMilliSeconds = int(elapsedMicroSeconds / 1000)
fprint.printTitleString('Elapsed MilliSeconds', fprint.indentFormat640, elapsedMilliSeconds)
return

def printStartTimeFinishTimeDifferenceMicroSeconds(startTime, finishTime): 
elapsedTime = finishTime - startTime
elapsedSeconds = elapsedTime.seconds
elapsedMicroSeconds = (elapsedSeconds * 1000000) + elapsedTime.microseconds
elapsedMilliSeconds = int(elapsedMicroSeconds / 1000)
fprint.printTitleString('Elapsed MicroSeconds', fprint.indentFormat640, elapsedMicroSeconds)
return

def printFunctionElapseTime(function, functionName):
fprint.printBeginExecFunction()
printDateTimeNow()
printElapsedTime()
fprint.printEndExecFunction()
return

# *** Test Functions ***

def testPrintDateTimeNow():
fprint.printBeginExecFunction()
printDateTimeNow()
fprint.printEndExecFunction()
return

def testPrintOneSecondElapsedTime():
fprint.printBeginExecFunction()
startTime = datetime.now()
delaySeconds(1)
finishTime = datetime.now()
printStartTimeFinishTimeDifferenceLong(startTime, finishTime)
fprint.printEndExecFunction()
return

def testPrintTwoSecondsElapsedTime():
fprint.printBeginExecFunction()
startTime = datetime.now()
delaySeconds(2)
finishTime = datetime.now()
printStartTimeFinishTimeDifferenceLong(startTime, finishTime)
fprint.printEndExecFunction()
return

def testPrintFunctionExecTimeLong(function):
#fprint.printBeginExecFunction()
startTime = datetime.now()
function()
finishTime = datetime.now()
printStartTimeFinishTimeDifferenceLong(startTime, finishTime)
#fprint.printEndExecFunction()
return

def testPrintFunctionExecTimeMilliSeconds(function):
#fprint.printBeginExecFunction()
startTime = datetime.now()
function()
finishTime = datetime.now()
printStartTimeFinishTimeDifferenceMilliSeconds(startTime, finishTime)
#fprint.printEndExecFunction()
return

def testPrintFunctionExecTimeMicroSeconds(function):
fprint.printBeginExecFunction()
startTime = datetime.now()
function()
finishTime = datetime.now()
printStartTimeFinishTimeDifferenceMicroSeconds(startTime, finishTime)
fprint.printEndExecFunction()
return

def testPrintOneSecondDelayFunctionLong():
fprint.printBeginExecFunction()
testPrintFunctionExecTimeLong(oneSecondDelay)
fprint.printEndExecFunction()
return

def testPrintOneSecondDelayFunctionMilliSeconds():
fprint.printBeginExecFunction()
testPrintFunctionExecTimeMilliSeconds(oneSecondDelay)
fprint.printEndExecFunction()
return

def testPrintTenMillionPassesFunctionMilliSeconds():
fprint.printBeginExecFunction()
testPrintFunctionExecTimeMilliSeconds(tenMillionPasses)
fprint.printEndExecFunction()
return

def testPrintOneMillionPassesFunctionMicroSeconds():
fprint.printBeginExecFunction()
testPrintFunctionExecTimeMicroSeconds(oneMillionPasses)
fprint.printEndExecFunction()
return

def testPrintOneThousandPassesFunctionMicroSeconds():
fprint.printBeginExecFunction()
testPrintFunctionExecTimeMicroSeconds(oneThousandPasses)
fprint.printEndExecFunction()
return

def printOneLineTenTimes():
printLine = 'abcxyz' 
repeatCount = 10

for i in range(10):
print(' abcxyz')
return

def testPrintPrintOneLineTenTimesFunctionMilliSeconds():
fprint.printBeginExecFunction()
testPrintFunctionExecTimeMilliSeconds(printOneLineTenTimes)
fprint.printEndExecFunction()
return

def loop100Passes():
#fprint.printBeginExecFunction()
loopCount = 100 
for count in range(loopCount):
pass
#fprint.printBeginExecFunction()
return

# ********************************************************************************
# ********************************************************************************

# *** Main Tests ***

def mainTests():
#testPrintDateTimeNow()
#testPrintOneSecondElapsedTime()
#testPrintTwoSecondsElapsedTime()
#testPrintOneSecondDelayFunctionLong()
#testPrintOneSecondDelayFunctionMilliSeconds()
#testPrintTenMillionPassesFunctionMilliSeconds()
#testPrintOneMillionPassesFunctionMicroSeconds()
#testPrintOneThousandPassesFunctionMicroSeconds()
#testPrintPrintOneLineTenTimesFunctionMilliSeconds()
testPrintFunctionExecTimeMicroSeconds(loop100Passes)
testPrintFunctionExecTimeMicroSeconds(loop100Passes)
testPrintFunctionExecTimeMicroSeconds(loop100Passes)
testPrintFunctionExecTimeMicroSeconds(loop100Passes)
testPrintFunctionExecTimeMicroSeconds(loop100Passes) 
return

# ********************************************************************************
# ********************************************************************************

# *** Init/Main Functions ***

# *** Init Function ***

def init():
pass
return

#*** Main Function ***

def main():
init()
mainTests() 
return

# ********************************************************************************
# ********************************************************************************

# *** Main ***

if __name__ == '__main__':
main()

# *** End of Program ***

# ********************************************************************************
# ********************************************************************************

''' Sample Output 2019nov2ghkt2020

>>> %Run ftime73.py

********************************************************************************

Begin Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

Function Name = testPrintFunctionExecTimeMicroSeconds
Elapsed MicroSeconds = 28

End Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

********************************************************************************


********************************************************************************

Begin Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

Function Name = testPrintFunctionExecTimeMicroSeconds
Elapsed MicroSeconds = 23

End Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

********************************************************************************


********************************************************************************

Begin Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

Function Name = testPrintFunctionExecTimeMicroSeconds
Elapsed MicroSeconds = 22

End Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

********************************************************************************


********************************************************************************

Begin Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

Function Name = testPrintFunctionExecTimeMicroSeconds
Elapsed MicroSeconds = 31

End Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

********************************************************************************


********************************************************************************

Begin Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

Function Name = testPrintFunctionExecTimeMicroSeconds
Elapsed MicroSeconds = 25

End Execute Function testPrintFunctionExecTimeMicroSeconds 2019-11-26 20:21

********************************************************************************

>>>

'''

''' Sample Output 2019nov26hkt1433

>>> %Run ftime71.py
Elapsed MicroSeconds = 31

'''

''' Sample Output 2019sep08hkt1208
>>> %Run ftime69.py

********************************************************************************

Begin Execute Function testPrintPrintOneLineTenTimesFunctionMilliSeconds tlfong01

Function Name = testPrintPrintOneLineTenTimesFunctionMilliSeconds
abcxyz
abcxyz
abcxyz
abcxyz
abcxyz
abcxyz
abcxyz
abcxyz
abcxyz
abcxyz
Elapsed MilliSeconds = 3

End Execute Function testPrintPrintOneLineTenTimesFunctionMilliSeconds tlfong01

********************************************************************************

>>> 
'''

 

.END

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s