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

sending 60 Hz sine wave USB

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



Joined: 08 Mar 2009
Posts: 1

View user's profile Send private message MSN Messenger

sending 60 Hz sine wave USB
PostPosted: Sun Mar 08, 2009 3:46 pm     Reply with quote

hi every one!, I'm a newbie in CCS and USB bulk mode but I'm trying to send a 60Hz signal but everytime I'm sending a package looks like the signal lose their periodicity, I'm just sending a package of 64 bytes, and its ok, but when the next one comes, you can see an irregular change on it.

for example I'm sending this array

128,132,136,139,143,147,150,154,158,161,165,169,172,176,179,182

and the next data should be 187 or 190, but suddenly this arrives in labview;

46,43,41,38,36,33,31,29,27,25,23,21,19,18,16,

obviously there are a lot of lost samples, and i don't know why.
has the labview any relation ??

and my other question is how can I use the special event trigger???, maybe that can be the solution.

I apologize, my english is pretty bad.

now in spanish


hola, estoy tratando de recibir en labview una señal seno de 60Hz mediante el modulo USB del pic 18f2550, lo que hago es crear un array y recolectar 64 muestras y enviarlas al labview, hasta ahi todo bien, el problema surge cuando voy a tomar el siguiente grupo de datos en el LV pues llegan unos datos que no son, pareciera que la señal no fuese muestreada en el momento en que los datos del array son enviados, por ejemplo si array[63]=40 se supone ke en el siguiente arreglo deberia ser array[1]=44, pero no es asi, en vez de eso se ve otro dato ya sea mucho menor como un 3 o mucho mayor como un 100, esto produce un efecto en el labview en el cual pareciera que la señal se corre y yo quiero que se vea continua, no se si depronto haya un retardo en labview o en el pic ke me daña la periodicidad de la onda.

y mi otra pregunta es si depronto alguien ha trabajado el special event trigger del modulo CCP, pues en el data sheet dice que mediante esta interrupción se puede manejar mejor el tiempo del adc.


gracias por la ayuda


thanks for the help


aqui va el codigo Fosc=48Mhz, bulk mode tx size 64

void iniciar_conversion (){
int8 envia[64]
int8 i;
int8 resultado ;
for(i=0;i<64;++i){

resultado=read_adc();
delay_ms(1);
envia[i]=resultado;
}
usb_put_packet(1, envia, 64, USB_DTS_TOGGLE);
}



void main(void) {

setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_64);
set_adc_channel(0);



usb_init();
usb_task();
usb_wait_for_enumeration();


while (TRUE)
{
if(usb_enumerated())
{
if (usb_kbhit(1))
{
while(True)
{

iniciar_conversion() ;


}
}
}
}
}


muchas gracias!
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