manu8888
Joined: 01 May 2006 Posts: 1
|
Problems with F Bus Please |
Posted: Mon May 01, 2006 11:55 am |
|
|
sorry for my English
I'm working with a Pic 16f877a for connect to a Nokia cell with Fbus
in this form PC-->micro-->phone--> and Work well but when I try to send information directly From Micro It does'nt work, Or When I try to Use FORCE_SW. Can any body Please Help me?
this is the Code
Code: |
#include "C:\1\CCS\aBRIL27\pr1.h"
//#include<PIC16F877A>
#include<stdlib.h> // Standard header for std input/output
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use delay(clock=20000000)
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7,STREAM=X,errors)
int i=0; //
Byte c;
void usart_sync(){ // USART <-> phone syncronization
for(i=0;i<200;i++)
fputc(0X55,X);// putc(0x55); // U
fputc(0xC1,X);//putc(0xC1);
}
void hwsw(){ // Getting HW/SW info
byte CONST send_frame_hwswinfo[16] = {0x1E,0x00,0x10,0xD1,0x00,0x07,0x00,0x01,
0x00,0x03,0x00,0x01,0x60,0x00,0x72,0xD5}; // Get HW/SW information
for(i=0;i<=15;i++)
Fputc(send_frame_hwswinfo[i],X);
}
void main() {
SET_TRIS_A( 0xFF );
SET_TRIS_B( 0xFF );
SET_TRIS_D( 0xFF );
SET_TRIS_E( 0xFF );
SET_TRIS_C( 0xFF );
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(VREF_LOW|-2);
usart_sync();
hwsw();
while(TRUE)
{
c = fgetc() ;
fputc(c);
}
}
/// and this don't Work
#include "C:\1\CCS\aBRIL27\pr1.h"
//#include<PIC16F877A>
#include<stdlib.h> // Standard header for std input/output
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use delay(clock=20000000)
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7,STREAM=X,errors,FORCE_SW)
int i=0; //
Byte c;
void usart_sync(){ // USART <-> phone syncronization
for(i=0;i<200;i++)
fputc(0X55,X);// putc(0x55); // U
fputc(0xC1,X);//putc(0xC1);
}
void hwsw(){ // Getting HW/SW info
byte CONST send_frame_hwswinfo[16] = {0x1E,0x00,0x10,0xD1,0x00,0x07,0x00,0x01,
0x00,0x03,0x00,0x01,0x60,0x00,0x72,0xD5}; // Get HW/SW information
for(i=0;i<=15;i++)
Fputc(send_frame_hwswinfo[i],X);
}
void main() {
SET_TRIS_A( 0xFF );
SET_TRIS_B( 0xFF );
SET_TRIS_D( 0xFF );
SET_TRIS_E( 0xFF );
SET_TRIS_C( 0xFF );
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(VREF_LOW|-2);
usart_sync();
hwsw();
while(TRUE)
{
c = fgetc() ;
fputc(c);
}
}
|
|
|