![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
mouadh Guest
|
réception de données sur le pic16f877 |
Posted: Thu May 03, 2007 10:39 am |
|
|
hi,
i have a probleme to send data from labview to pic,
i had alredy send data from pic to labview, it's ok .
i nned help to communicate end sending data to pic.
thre is my program:
#include<16F877.h>
#include<stdlib.h>
#use delay(clock = 4000000)
#fuses HS,NOWDT,PUT,NOPROTECT, NOLVP
#use rs232(baud = 9600, xmit = pin_c6, rcv = pin_c7)
boolean rxf=0; //initialisation de bit de flag
#int_rda // intrruption CAN --> (RS232 receive data available)
void rda();
void Init() //procedure d'initialisation des ports de convertisseur et le canal d'acquisition du signal
{
setup_adc_ports(A_ANALOG); //tous les entrés de port "A" sont analogiques
setup_adc(adc_clock_div_32);//initialisation du clock interne de convertisseur
set_adc_channel(0); // initialisation de la voie d'acquisition
enable_interrupts(int_rda); //activer l'interruption materielle CAN-->(RS232 receive data available)
enable_interrupts(global); //activer l'interruption globale-->adc_off
SET_TRIS_B( 0x00 );
}
void Read_tx232()
{
unsigned int x;
x= read_adc(); //X reçoit le résulat de conv
putc(x); //**PIC-PC
rxf =1;
}
void write_rx232()
{
char source;
unsigned int transmit;
source = getc();
transmit=source-48 //conversion de char en int
output_b(transmit);
rxf =1;
}
void main()
{
OUTPUT_B(0x00);
Init();
while(1)
{
Read_tx232();
rxf = 0;
write_rx232();
delay_ms( (500) );
}
} |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 03, 2007 3:39 pm |
|
|
Quote: | I need help to communicate sending data to pic. |
Quote: |
#int_rda
void rda();
void Init() {
setup_adc_ports(A_ANALOG);
setup_adc(adc_clock_div_32);
set_adc_channel(0);
enable_interrupts(int_rda);
enable_interrupts(global);
SET_TRIS_B( 0x00 );
} |
You have an #int_rda declaration, but there is no code in the rda()
function. This is not correct.
Look at the CCS example file, Ex_sisr.c, which shows how to use
the #int_rda interrupt. The file is in this folder:
c:\Program Files\Picc\Examples |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|