Skip to content
Snippets Groups Projects
Commit 783d777a authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

Tested Clock setting / reading on HW

parent b590f5a8
No related branches found
No related tags found
1 merge request!2Modified the scripts to run on Raspberry Pi.
......@@ -23,7 +23,7 @@ if os.name =="posix":
else:
from I2C_serial import *
I2CBUSNR=1
I2CBUSNR=3
sleep_time=0.05
READ_LOCK = True
......@@ -37,8 +37,7 @@ def Read_byte_PLL(reg_address, nof_bytes=1, ADDRESS=0x20 ):
#
# Read Byte from the ADC
#
I2C_device = I2C(ADDRESS)
I2C_device.bus = I2CBUSNR
I2C_device = I2C(ADDRESS, BUSNR=I2CBUSNR)
PLL_rw = 0x01 # 0 for write, 1 for read
I2C_device.write_bytes(0x06, 0x2C)
......
......@@ -23,7 +23,7 @@ if os.name =="posix":
else:
from I2C_serial import *
I2CBUSNR=1
I2CBUSNR=3
sleep_time=0.05
PWR_RST = False
SET_PLL = True
......@@ -42,8 +42,7 @@ def Write_byte_PLL(reg_address, wr_data, ADDRESS=0x20):
#
# Write Byte to the ADC
#
I2C_device = I2C(ADDRESS)
I2C_device.bus = I2CBUSNR
I2C_device = I2C(ADDRESS, BUSNR=I2CBUSNR)
PLL_rw = 0x00 # 0 for write, 1 for read
stri = "Write : 0x{0:{fill}2x} to Address : 0x{1:{fill}2x}".format(wr_data, reg_address, fill='0')
print(stri)
......@@ -70,8 +69,7 @@ def Read_byte_PLL(reg_address, nof_bytes=1, ADDRESS=0x20 ):
#
# Read Byte from the ADC
#
I2C_device = I2C(ADDRESS)
I2C_device.bus = I2CBUSNR
I2C_device = I2C(ADDRESS, BUSNR=I2CBUSNR)
PLL_rw = 0x01 # 0 for write, 1 for read
I2C_device.write_bytes(0x06, 0x2C)
......@@ -107,8 +105,7 @@ def Read_byte_PLL(reg_address, nof_bytes=1, ADDRESS=0x20 ):
def power(state):
ADDRESS_IO = 0x20
I2C_IO_device = I2C(ADDRESS_IO)
I2C_device.bus = I2CBUSNR
I2C_IO_device = I2C(ADDRESS_IO, BUSNR=I2CBUSNR)
I2C_IO_device.write_bytes(0x06, 0x2C)
I2C_IO_device.write_bytes(0x07, 00)
if state:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment