Other Parts Discussed in Thread: USB2ANY
你好 我的USB2ANY设备坏了 我是直接通过串口写脚本去实现输出的,目前屏幕已经可以正常显示,但是存在的问题是屏幕显示有些许问题,屏幕边缘图像感觉有锯齿 不平滑
图像如下:
PLL配置代码如下:
from smbus2 import SMBus
import struct
bus_number = 3
bus = SMBus(bus_number)
#UB947 = int(input("请输入编码器设备地址1: "), 0)
UB988 = int(input("请输入编码器设备地址2: "), 0)
bus.write_byte_data(UB988,0x04,0xC8, force=True)
### 在对DTG寄存器进行编程时,应将DTG模块保持在复位状态,最后再释放
## Hold Des DTG in reset
## *********************************************
bus.write_byte_data(UB988,0x40,0x50, force=True) #Select DTG Page
bus.write_byte_data(UB988,0x41,0x32, force=True)
bus.write_byte_data(UB988,0x42,0x6, force=True) #Hold Port 0 DTG in reset
bus.write_byte_data(UB988,0x41,0x62, force=True)
bus.write_byte_data(UB988,0x42,0x6, force=True) #Hold Port 1 DTG in reset
##### port0 PG-stting
bus.write_byte_data(UB988,0x40,0x50, force=True)
bus.write_byte_data(UB988,0x41,0x20, force=True)
bus.write_byte_data(UB988,0x42,0x5F, force=True)### P0 同步极性以及 pixel format setting/1.16
####水平后沿-P0-Hstart
bus.write_byte_data(UB988,0x40,0x50, force=True)
bus.write_byte_data(UB988,0x41,0x29, force=True)
bus.write_byte_data(UB988,0x42,0x40, force=True)
bus.write_byte_data(UB988,0x41,0x2A, force=True)
bus.write_byte_data(UB988,0x42,0x82, force=True)
####垂直后沿-P0
####总水平帧大小-P0
####总垂直帧大小-P0
####活动水平帧大小-P0
####活动垂直帧大小-P0
####水平同步宽度-P0
####垂直同步宽度-P0
bus.write_byte_data(UB988,0x40,0x50, force=True)
bus.write_byte_data(UB988,0x41,0x2F, force=True)
bus.write_byte_data(UB988,0x42,0x40, force=True)
bus.write_byte_data(UB988,0x41,0x30, force=True)
bus.write_byte_data(UB988,0x42,0x2a, force=True)
##### port1 PG-stting
bus.write_byte_data(UB988,0x40,0x50, force=True)
bus.write_byte_data(UB988,0x41,0x50, force=True)
bus.write_byte_data(UB988,0x42,0x5F, force=True)### P1 同步极性以及 pixel format setting
####水平后沿-P1-Hstart
bus.write_byte_data(UB988,0x40,0x50, force=True)
bus.write_byte_data(UB988,0x41,0x59, force=True)
bus.write_byte_data(UB988,0x42,0x40, force=True)
bus.write_byte_data(UB988,0x41,0x5A, force=True)
bus.write_byte_data(UB988,0x42,0x82, force=True)
####垂直后沿-P1
####总水平帧大小-P1
####总垂直帧大小-P1
####活动水平帧大小-P1
####活动垂直帧大小-P1
####水平同步宽度-P1
bus.write_byte_data(UB988,0x40,0x50, force=True)
bus.write_byte_data(UB988,0x41,0x5F, force=True)
bus.write_byte_data(UB988,0x42,0x40, force=True)
bus.write_byte_data(UB988,0x41,0x60, force=True)
bus.write_byte_data(UB988,0x42,0x29, force=True)
####垂直同步宽度-P1
## *********************************************
## Release Des DTG reset
## *********************************************
bus.write_byte_data(UB988,0x40,0x50, force=True) #Select DTG Page
bus.write_byte_data(UB988,0x41,0x32, force=True)
bus.write_byte_data(UB988,0x42,0x4, force=True) #Release Port 0 DTG
bus.write_byte_data(UB988,0x41,0x62, force=True)
bus.write_byte_data(UB988,0x42,0x4, force=True) #Release Port 1 DTG
# N-Divder P-Divder设置
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x18,force=True)
bus.write_byte_data(UB988,0x42,0x24,force=True)# N 36
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x2D,force=True)
bus.write_byte_data(UB988,0x42,0x01,force=True)# P 2
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x08,force=True)
bus.write_byte_data(UB988,0x42,0xF6,force=True)# PLL NUM
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x09,force=True)
bus.write_byte_data(UB988,0x42,0xFF,force=True)# PLL NUM
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x0A,force=True)
bus.write_byte_data(UB988,0x42,0xFF,force=True)# PLL NUM
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x0B,force=True)
bus.write_byte_data(UB988,0x42,0xF6,force=True)# PLL DENO
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x0C,force=True)
bus.write_byte_data(UB988,0x42,0xFF,force=True)# PLL DENO
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x0D,force=True)
bus.write_byte_data(UB988,0x42,0xFF,force=True)# PLL DENO
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x38,force=True)
bus.write_byte_data(UB988,0x42,0x20,force=True)# MASH SETTING
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x0E,force=True)
bus.write_byte_data(UB988,0x42,0x80,force=True)# SSCG -Enable
'''
bus.write_byte_data(UB988,0x01,0x40,force=True)# reset
#bus.write_byte_data(UB988,0x04,0xc8,force=True)# I2C_Correspond_set
'''
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x20,force=True)
bus.write_byte_data(UB988,0x42,0x80,force=True)# cho_enable
bus.write_byte_data(UB988,0x40,0x2C,force=True)
bus.write_byte_data(UB988,0x41,0x22,force=True)
bus.write_byte_data(UB988,0x42,0x80,force=True)# ch1_enable
#bus.write_byte_data(UB947,0x65,0x08,force=True)# 947 pattern choice
#bus.write_byte_data(UB947,0x64,0x31,force=True)# 947 pattern output