AN1154 STMicroelectronics, AN1154 Datasheet - Page 65

no-image

AN1154

Manufacturer Part Number
AN1154
Description
8031-PSD DESIGN TUTORIAL
Manufacturer
STMicroelectronics
Datasheet
AN1154 - APPLICATION NOTE
//
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++
initial
begin
//Initialize the signals first
wr = 1; rd = 1;
reset = 0;adio = ’h0000;
ale = 0;psen = 1;
adrout = Z8;
measured_value = ’h0;
desired_value = ’h0;
PGA_data=Z4;cntrl = Z3;
Intrn = Z1;Start_Conv = Z1;
Trim = Z1;Boost = Z1;
JCEn = 1;
#100 reset = 1; // Take the PSD out of reset after 100ns
//We are now ready to do some configuration of the PSD
//Port A configuration
//Configure Port A, pins pa4 to pa0 to output the latched address, and the rest
//of the port will output control information in MCU I/O mode.
//Writing "1F" to the Port A control register enables latched address output on
//pins pa4 to pa0, and the rest of the port to output MCU I/O.
write(Port_A_Cntl_Reg, ’h1f);
//Writing "FF" to Port A’s direction register sets up Port A pins to be outputs.
write(Port_A_Dir_Reg,’hff);
//Port B configuration
//Since there is no latched address output on Port B, and its control register
//defaults to MCU I/O mode output, only the direction register needs to be setup.
//Only pins pb3 to pb0 will be outputting data, and the rest will be receiving
//input
write(Port_B_Dir_Reg,’h0f);
//All of Port C is output (with the exception of the Vstby input
write(Port_C_Dir_Reg,’hfb);
65/83

Related parts for AN1154