Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20562

BASCOM-AVR : I need help Ltc2621 DAC does not work : REPLY

$
0
0
Maybe you need to shiftout all 24 bits use a Long for this you can try this test for 4095 : [code:1:dd61cd5810]$regfile = "m16adef.dat" $crystal = 13000000 $baud = 38400 $hwstack = 150 $swstack = 150 $framesize = 120 ' 24-BIT INPUT WORD ' 16-bit data word ' DATA (14 BITS Data + 2 DON’T CARE BITS) ' The 4-bit command, C3-C0, is loaded first ' Comandos C3,C2,C1,C0 ' 0 0 0 0 Write to Input Register ' 0 0 0 1 Update (Power Up) DAC Register ' 0 0 1 1 Write to and Update (Power Up) ' 0 1 0 0 Power Down ' 1 1 1 1 No Operation 'Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 1 'Spiinit 'Configuracao Ports saida Ltc2621_mo Alias Portb.5 Ltc2621_clk Alias Portb.7 Ltc2621_cs Alias Portb.4 Config Ltc2621_mo = Output Config Ltc2621_clk = Output Config Ltc2621_cs = Output 'Dim Dados_c As Byte 'Dados_c = &B00110000 Dim Ltc2621_dados As Long Dim X As Word , U As Word X = 4094 'test value Set Ltc2621_cs Incr X '4095 U = X Ltc2621_dados = &B0000_0000_0011_0000_0000_0000_0000_0000 Shift U , Left , 4 Ltc2621_dados = Ltc2621_dados + U ' U = 4095 (1111_1111_1111_0000) Shift Ltc2621_dados , Left , 8 Reset Ltc2621_cs Waitus 200 'shiftout 24 bits 0011_0000_1111_1111_1111_0000 (Dados_c + 4095) Shiftout Ltc2621_mo , Ltc2621_clk , Ltc2621_dados , 1 , 24 , 250 'only send 24bits MSB first Set Ltc2621_cs Waitms 5 End[/code:1:dd61cd5810]

Viewing all articles
Browse latest Browse all 20562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>