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

Toshiba TCD1304AP linear CCD driver ...

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
mohammad3d



Joined: 28 Mar 2009
Posts: 17

View user's profile Send private message Send e-mail

Toshiba TCD1304AP linear CCD driver ...
PostPosted: Mon Jul 29, 2019 1:52 am     Reply with quote

Hi every one,
I try to drive a TCD1304AP linear ccd with PIC24Hj12gp201 Micro and share this driver with all of you,
This driver work about 60 Fps with minimum part and connection.
I connect TCD1304AP driectly to PIC and discard 74hc04 invert buffer driver that use in TCD1304AP PDF circuit. 2sa1015 transistor still remain.

try this and enjoy,
Code:


//compiler ver 4.140
#include <24hj12gp201.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOJTAG                   //JTAG disabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOIOL1WAY                //Allows multiple reconfigurations of peripheral pins
#FUSES NOWINDIS                 //Watch Dog Timer in Window mode
#FUSES WPRES128                 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS16                 //Watch Dog Timer PostScalar 1:32768
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES FRC                      //Internal Fast RC Oscillator
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES NOOSCIO                  //OSC2 is general purpose output
#FUSES NOPR                     //Pimary oscillaotr disabled
       
#use delay(clock=80M,internal)//internal oscillaotr with PLL at 80Mhz (40MIPS)
#use standard_io(all)

#PIN_SELECT OC1=PIN_B4 //remappable peripheral pin assigned to Output Compare 1

//  PIC          TCD1304AP
//B7(pin 10)---->ICG(pin3)
//B4( pin 8)---> Mc (pin4) 1Mhz PWM
//B9(pin 12)---> SH (pin5)

#define ICG PIN_B7
#define SH  PIN_B9
int16 shutter=1;
void main()
  {
//setup PWM1 to 1MHZ 50%
setup_timer2(TMR_INTERNAL | TMR_DIV_BY_1, 39);
setup_compare(1, COMPARE_PWM | COMPARE_TIMER2);
set_pwm_duty(1, 19);
//initial state of control pin   
output_bit( SH, 0);
output_bit( ICG, 1);
for(;;)//main loop
   {
     //sync to rise edge of master clock
      while (input_state(PIN_B4)==1);//check logical level of master clock pin B4
      while (input_state(PIN_B4)==0);
      while (input_state(PIN_B4)==1);

      delay_cycles(20 );
      output_bit( ICG, 0);
      delay_cycles(20);
      output_bit( SH, 1);
      delay_us(5);

      while (input_state(PIN_B4)==1);//check logical level of master clock pin B4

      output_bit( SH, 0);
      delay_us(3);

      while (input_state(PIN_B4)==0);//check logical level of master clock pin B4
      while (input_state(PIN_B4)==1);
      while (input_state(PIN_B4)==0);

      delay_cycles( 1 );
      output_bit( ICG, 1);
      delay_us(5);
      output_bit( SH, 1);
      delay_us(5);
      //generate electric shutter
      for(shutter=1;shutter<800;shutter++)
         {
           output_bit( SH, 0);
           delay_us(15);
           output_bit( SH, 1);
           delay_us(5);
         }
  }//main loop       
}//main

Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library 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