|
|
View previous topic :: View next topic |
Author |
Message |
rodolfo
Joined: 09 Apr 2004 Posts: 1 Location: Buenos Aires - Argentina
|
TC 1321 |
Posted: Fri Apr 09, 2004 2:10 pm |
|
|
Somebody has used the TC1321?
I bought 50 pcs for a redesign and have tried to use it with standard I2C PCM functions.
It does not work.
I have considered the discussion posted: Fri Dec 05, 2003 7:36 am "10 bit DAC I2C"
Program listing:
#include <16f873.h>
#fuses HS,NOWDT,NOPROTECT
#device PIC16f873 *=16
#use delay(clock=20000000) //20 MHz
#use i2c(MASTER,SCL=PIN_C3,SDA=PIN_C4,NOFORCE_SW) //HW forced
void outda(long val)
{
int v1=0;
int v2=0;
val&=0x03FF;
val<<=6;
v1=(byte)val; //LSB
v2=val>>8; //MSB
i2c_start();
i2c_write(0x90); //address
i2c_write(0x00); //command
i2c_write(v2); //data
i2c_write(v1); //data
i2c_stop();
}
main()
{
long aux;
while(True)
{
delay_ms(20);
for(aux=220;aux<1024;aux++)
{
delay_ms(3);
outda(aux);
}
}
} //END
Compiler:
CCS PCM C Compiler, Version 2.713
Circuit:
uC: PIC 16F874-20/sp
DAC: TC1321
Pull up resistors: 22k tied to 5VDC.
Can somebody tell me if successfully have used the TC1321?
Thanks in advance. |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
|
Posted: Fri Apr 09, 2004 3:24 pm |
|
|
Pullup resistors should be in the range 2k2 to 4k7.
Add NOLVP to #fuses line.
Comments by PCM Programmer in the old post apply - you need a reference voltage and a buffer amp.
It's an old compiler version, the NOFORCE_SW for hardware i2c has been replaced with FORCE_HW in later versions, a bit confusing really.
If you still have problems, try software i2c by leaving out NOFORCE and add these two lines to set the pins to inputs - the pullups will pull both SCL and SDA to the idle high state.
output_float(PIN_C3);
output_float(PIN_C4);
HTH |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|