CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

read digital data by pic18f4550

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
spec



Joined: 02 Oct 2010
Posts: 4

View user's profile Send private message Yahoo Messenger ICQ Number

read digital data by pic18f4550
PostPosted: Sat Oct 02, 2010 11:31 am     Reply with quote

Hi everyone,

I have a TDC-GP1 chip (time to digital converter: www.acam.de/fileadmin/Download/pdf/English/DB_GP1_e.pdf) used to measure ultra fast-time. I want to develop a electronics kit for some applications. I use a pic184550 to read data from TDC-GP1 chip and trans. to PC. Can you help me? How can I design ..?

Thanks!
_________________
spectroscopy


Last edited by spec on Sun Oct 03, 2010 12:45 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 02, 2010 12:26 pm     Reply with quote

You need to build or buy a demo board. Or buy a "break-out" board for
the TDC-GP1 chip, and then connect it to a PIC demo board. Then you
need to write a software driver for the TDC-GP1, using the CCS compiler.
If you are a newbie in hardware and software, this is going to be
extremely difficult. You really need to know at least some of the C
language before you begin. This TDC-GP1 project should not be your
first PIC project. Do some other work first, so you can learn the basics.

The TDC-GP1 data sheet has some generic sample C source code in it.
This could possibly be used to help you write the driver in CCS. I don't
want to do the project for you. I just wanted to tell you what you need to
do, to begin.
spec



Joined: 02 Oct 2010
Posts: 4

View user's profile Send private message Yahoo Messenger ICQ Number

PostPosted: Sun Oct 03, 2010 1:28 am     Reply with quote

PCM programmer wrote:
You need to build or buy a demo board. Or buy a "break-out" board for
the TDC-GP1 chip, and then connect it to a PIC demo board. Then you
need to write a software driver for the TDC-GP1, using the CCS compiler.
If you are a newbie in hardware and software, this is going to be
extremely difficult. You really need to know at least some of the C
language before you begin. This TDC-GP1 project should not be your
first PIC project. Do some other work first, so you can learn the basics.

The TDC-GP1 data sheet has some generic sample C source code in it.
This could possibly be used to help you write the driver in CCS. I don't
want to do the project for you. I just wanted to tell you what you need to
do, to begin.


Thank you for your support. I have developed a test boad, this link are SCH. and PCB files in DXP2004 protel: http://www.megaupload.com/?d=L7VX2UBM

I'm also learning some projects in CCS with pic18f4550 such as led blink, communication with rs232 standard by this test boad. But I don't know that how to configure control registers of TDC-GP1 to read data. Can you suggest something to help me?

Thanks so much!
_________________
spectroscopy
spec



Joined: 02 Oct 2010
Posts: 4

View user's profile Send private message Yahoo Messenger ICQ Number

PostPosted: Thu Oct 07, 2010 11:28 pm     Reply with quote

Hi every one,

I have made test board and program for this project. And I'm trying to test program, I want to create two pulses from pin C0 and C1 (C1 delay 10us compare with C0) but it's not run:
Code:

#include "C:\gpt2\main.h"

int8 valid, nk0, vk0;
int16 nk1, vk1, t;

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_CLOCK_DIV_2);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab

   // TODO: USER CODE!!
  while (true)
         {
      while(true)
      {
      output_high(PIN_C0);
      delay_us(10);
      output_high(PIN_C1);
      output_low(PIN_C0);
      delay_us(10);
      break;
      }
      output_toggle(pin_c2);
      delay_ms(100);
         Output_high(pin_a0);
         Output_high(pin_a1);
         Output_low(pin_a2);
         Output_high(pin_a3);
         Output_d(0x07);
         output_low(pin_b0);
         valid=0;
      output_high(pin_b1);
      output_low(pin_b2);
      output_low(pin_b3);
      output_low(pin_b4);
            while(valid==0)
            {
            valid=pin_b0;
               }
         Output_low(pin_a0);
         Output_low(pin_a1);
         Output_low(pin_a2);
         Output_low(pin_a3);
         nk0=input_d();
         nk1=input_d(); 
         vk0=input_d();
         vk1=input_d();
      vk1=vk1*256;         
      vk1=vk1|vk0;         
      nk1=nk1*256;     
      nk1=nk1|nk0;           
      t = 83.333*((float)(vk1)+(float)(nk1)/65536.0);
      t = output_d(t);
      printf("gia tri la: %lu\n", t);
         }
}

can you help me!

Thanks so much!
_________________
spectroscopy
tae



Joined: 15 Jan 2010
Posts: 11

View user's profile Send private message

PostPosted: Fri Oct 08, 2010 5:15 am     Reply with quote

Code:
      while(true)
      {
      output_high(PIN_C0);
      delay_us(10);
      output_high(PIN_C1);
      output_low(PIN_C0);
      delay_us(10);
      break;
      }

A rather strange use of "While" Smile

Code:
            while(valid==0)
            {
            valid=pin_b0;
               }

And what's this ??
spec



Joined: 02 Oct 2010
Posts: 4

View user's profile Send private message Yahoo Messenger ICQ Number

PostPosted: Fri Oct 08, 2010 11:58 pm     Reply with quote

tae wrote:
Code:
      while(true)
      {
      output_high(PIN_C0);
      delay_us(10);
      output_high(PIN_C1);
      output_low(PIN_C0);
      delay_us(10);
      break;
      }

A rather strange use of "While" Smile

Code:
            while(valid==0)
            {
            valid=pin_b0;
               }

And what's this ??

Thanks, Pin B0 connect with Int.flag of TDC-GP1 chip (when Int.flag in high level, TDC-GP1 allow data to read from register), hence I use while loop this.
_________________
spectroscopy
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Sat Oct 09, 2010 2:55 am     Reply with quote

The problem is the syntax.
'PIN_B0', is just a _number_, used as a reference to address a particular pin. To read a value _from_ 'PIN_B0', requires the used of an 'input' statement. Then, there is no point at all in copying the value into another register.
So:
Code:

while (input(PIN_B0))==0) ;


Waits for PIN_B0 to go high. What you currently have, will never wait.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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