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

Place Help me, program Array Sensor 256 PIXELES

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



Joined: 01 Oct 2003
Posts: 4
Location: estudiante

View user's profile Send private message

Place Help me, program Array Sensor 256 PIXELES
PostPosted: Wed Sep 22, 2004 8:44 am     Reply with quote

Helping in this project, this it is my situation.


In the school they asked me that he could capture the values of a sensor formed by an arrangement of 256 pixeles of the hamamatsu, and that the values of each one of the pixeles the capture by means of the convertor A/D of the own PIC via the protocol RS232.

For they facilitated me to it the compiler of PIC in language C of CCS to see 3.11.

The data of the sensor are here; http://usa.hamamatsu.com/hcpdf/parts_S/S8377-128BQ.pdf

I assist this project, use the PIC16F876,por to be one of those but common among the stores of electronic of Barcelona.

The work begins it starting the operation of the arrangement of 256 pixeles, for suy operation it is required of two clock signal, one used as shot or period of integration (SI)y the second as sincronismo (clk) until this moment all road well.

This is the code that generates the pulses of operation of the arrangement.

#include <16f876.h>
#device ADC=10 // A/D Result format
#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT,NOLVP,NOCPD,NOWRT

#use delay (CLOCK=10000000)
#use rs232 (BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7)

#use fast_io (b)
#byte porta = 5
#byte portb = 6
#byte portc = 7

main()
{

int i;
set_tris_a(0x00);
set_tris_b(0x00);
portb=0;
porta=0;
Do
{

bit_set(PORTB,7); //CLK High
bit_set (PORTB,6); //SI High

bit_clear(PORTB,6); //SI High
delay_us(1);
bit_clear (PORTB,7); //CLK Low

delay_us(1);
bit_set (PORTB,6); //SI High
delay_us(1);
bit_set(PORTB,7); //CLK High

for(i=0; i<255; i++)
{
bit_clear(PORTB,7); //CLK Low
delay_us(1);
bit_set(PORTB,7); //CLK High
}
delay_ms(50);
}
while(1);
}


With this code you could confirm the good operation of Array.

The inconvenience that is presented and it is part of my current school situation. I am not layers of capturing the 256 pixeles or some series of them (64 0 128 picxels) using the functions of the converter A/D to be able to send it via the protocol RS/232 and to observe the results in the windows (hipertimal).

This is the I finish code and I observe that it doesn't work..

#include <16f876.h>

#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT,NOLVP,NOCPD,NOWRT
#device ADC=10

#use delay(CLOCK = 10000000)
#use rs232(BAUD = 9600, XMIT = PIN_C6, RCV = PIN_C7)

#byte porta = 5
#byte portb = 6
#byte portc = 7

unsigned char Data[64];
unsigned long indice=0;

#INT_AD
void rutina_AD()
{
Data[indice]=read_adc(ADC_READ_ONLY);
indice++;
}

void main (void)
{

long data; // Variable para los datos del A/D.
int i;
int j;
int k; // Variable para el inicio del retardo.

//analog data 1
Setup_adc_ports (RA0_RA1_RA3_ANALOG); //RA3 is Ref+ others A/D
Setup_adc (ADC_CLOCK_DIV_32); //Fosc/32 FULL speed

set_tris_a(0x00); // Los puertos a y b se configuran como salida
set_tris_b(0x00); // Si se busca que sean entradas, basta con colocar FF

portb=0; // Inicialisa el puerto "a" a cero
porta=0; // Inicialisa el puerto "b" a cero

//*** Se definen el inicio de la seņal (SI) y (CLK) del S8733***//
//**********************************************************************************//

bit_set(PORTB,7); //CLK High
bit_set (PORTB,6); //SI High

bit_clear(PORTB,6); //SI High
delay_us(1);
bit_clear (PORTB,7); //CLK Low

delay_us(1);
bit_set (PORTB,6); //SI High
delay_us(1);
bit_set(PORTB,7); //CLK High

//*** Se iniciA el ciclo de captura del A/D PIC16F876 una vez en alto la seņal (SI) ***//
//*****************************************************************************************/


Set_adc_channel(1); //set channel
Delay_us(10); // retardo en 1 us
enable_interrupts(INT_AD);
enable_interrupts(GLOBAL);

for(i=0; i<64; i++)
{
bit_clear(PORTB,7); //CLK Low
read_adc(ADC_START_ONLY); //iniciar conversion
bit_set(PORTB,7); //CLK High
delay_us(1);
}
delay_ms(50);

disable_interrupts(INT_AD);


//*** Se iniciA el ciclo de captura del A/D PIC16F876, e imprime los 64 valores ***//
//*****************************************************************************************/

for(K=0; k<64; k++) // Se coloca la rutina de 64 ciclos para imprimir
{
Printf ("%4LX\r",Data[k]);

}

}


In opinion the my friends' I am changes PIC16F876 for the PIC18F452, now the problem is presented that the compiler doesn't recognize the instruction ADC_READ_ONLY, and no longer you that to make,

please they can help he stops to take out this project..

Any help they will be very grateful for it.



Gustavo A. Mtz.
Lift up yo
Guest







[spam] delivered a tray of fresh
PostPosted: Sat Mar 26, 2005 12:51 pm     Reply with quote

While we had no choice in the matter, we were curious none the less A Feeling Of Rain. I gently set up a spam eating rhythm that had my tongue lathing the outside of her fat little twat then dipping inside for a half dozen shallow strokes before pulling out to start anew Guinness Theme. The Doctor put on a rubber glove and poked around inside my [spam] for a few minutes Molasses. I kissed and spam up her thighs and onto the flat plain of her stomach G Lock Easymail. Mistress Rachel called me over to where she was chatting with Sir William and Mistress Goddess Nickel Plated Utilities.
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