LTC 1418 14bit ADC- Serial mode


Closed Thread
Results 1 to 5 of 5
  1. #1
    paul.mcallister's Avatar
    paul.mcallister Guest

    Default LTC 1418 14bit ADC- Serial mode

    Hi,

    I am experimenting with an LTC1418, 14 bit ADC in serial mode connected to a PIC16F876a.

    I think I have it configured correctly but I might have a problem with the serial interface code.

    Has anyone ever used this device, and if so could you share with me some code examples.

    Thanks, Paul

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    How about sending your code here so we may find some mistake?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    paul.mcallister's Avatar
    paul.mcallister Guest


    Did you find this post helpful? Yes | No

    Default LTC 1418 14 ADC - Serial Mode

    Hi all,

    I ultimately got this device to work, the problem was mostly hardware configuration. For any one who needs to do this in the future here is some stub code to get you started:


    ' Stub code for testing LTC 1418 ADC in serial mode
    ' Target processor - 16F876A
    '
    ' 1418 configuration
    ' - CS = gnd
    ' - Ext/Int = gnd
    ' - Ser/Par = hi
    ' - shdn = hi
    ' - Vss = gnd
    ' - A- = gnd
    ' Seems to convert faster that the busy flag can be read at 4 mhz
    '
    '
    '

    '----- Include Files -----------------------------------------------------------

    Define LOADER_USED 1

    INCLUDE "modedefs.bas"

    '----- I/O pins ----------------------------------------------------------------

    'Port B0 to B3 = Input pins, B4 to B7 = Output
    pinADCSerialOut var PORTB.0 ' ADC converter out, pin 19
    'pinAdcbusy VAR PORTB.1 ' ADC Busy flag, pin 26
    ' VAR PORTB.2 ' Unused
    ' VAR PORTB.3 ' Unused
    ' VAR PortB.4 ' Unused
    ' VAR PortB.5 ' Unused
    ' Var PortB.6 ' Unused
    ' VAR PortB.7 ' Unused


    'Port C0 to C6 = Output pins
    pinAdcCLK var PORTC.0 ' SLCL, pin 17
    pinAdcRD var PORTC.1 ' RD, pin 23
    pinConvStart var PORTC.2 ' CONVST, pin 24
    ' var PORTC.3 ' Unused
    ' var PORTC.4 ' Unused
    ' var PORTC.5 ' Unused
    ' PortC.6 ' serial out
    ' PortC.7 ' serial in

    ' 0 = output, 1 = input
    ioPortB con %00000111' Set Port B.0 ~ B.2 to inputs, B3 ~ B.7 to output
    ioPortC con %10000000' Set Port C.0 ~ C.6 to outputs, C.7 as input

    '----- DEBUG Port Definitions --------------------------------------------------

    DEFINE DEBUG_REG PORTC
    DEFINE DEBUG_BIT 6 'Debug serial output, PORTC.6 set to an output
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 0
    DEFINE DEBUGIN_REG PORTC
    DEFINE DEBUGIN_BIT 7 'Debug serial input, PORTC.7 set to an input
    DEFINE DEBUGIN_MODE 0
    DEFINE DEBUG_PACING 500
    DEFINE CHAR_PACING 500

    '----- General variables -------------------------------------------------------

    AdcVal var word ' 14 bit value from the ADC

    ' *-----------------------------------------------------------------------------

    high pinAdcRD

    loop:

    readADC:
    ' ** get one ADC reading


    low pinConvStart ' pinConvStart = C.2, connected to pin 24, CONVST
    pauseUS 100
    high pinConvStart
    pauseUS 100 ' Wait, instead of reading the busy flag

    low pinAdcRD ' pinAdcRD = C.1, connected to pin 23, READ

    SHIFTIN pinADCSerialOut, pinAdcCLK, MSBPRE, [AdcVal\14]
    ' pinADCSerialOut = B.0, connected to pin 19, Dout
    ' pinAdcCLK = C.0, connected to pin 17, SCLK
    high pinAdcRD


    debug "AdcVal ", sbin AdcVal
    debug " ", sdec AdcVal
    debug CR

    pause 500
    goto loop

    ' End of program-----------------------------------------

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    you miswired the EXT/INT pin. It have to be tied to VCC.

    Also, you should use HSERIN instead of DEBUG. Your PIC have a USART... use it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    paul.mcallister's Avatar
    paul.mcallister Guest


    Did you find this post helpful? Yes | No

    Default LTC 1418 14 ADC - Serial Mode

    Steve,

    Thanks for the tip on HSERIN, I haven't used them in serial mode much, hence not given it much thought.

    Yes your correct, Ext/Int needs to be tied low. I checked my breadboard and that is what I had done, however my documentation in the code is incorrect.
    I'll fix that, otherwie I'll look at it in 6 months time, get it wrong and wonder why.

    Paul

Similar Threads

  1. Serial Communication Inverse mode
    By titanvision in forum Serial
    Replies: 4
    Last Post: - 27th October 2008, 02:53
  2. Oscillator stops when touching with a wire
    By Wilbert Ingels in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 25th April 2008, 08:51

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts