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 CCS Technical Support

enable_interrupt(global) PROBLEM!

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







enable_interrupt(global) PROBLEM!
PostPosted: Wed Apr 14, 2004 9:36 am     Reply with quote

I use 2 serial in my Pic 16f876 :
The first is hardware the second is software for PRINTER.
My program is:



/* -----------------------------------------------------------------------
Inizializzazione Dispositivo Pic
--------------------------------------------------------------------------*/
void initDevice (void)
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_32);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_2304MS);//576MS
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); // Tick 8us
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
enable_interrupts(INT_RDA);
enable_interrupts(INT_TIMER1);
enable_interrupts(global);
set_tris_a (IO_PORTA) ;
set_tris_b (IO_PORTB) ;
set_tris_c (IO_PORTC) ;
}




//////////////////////////////////

void initPrn (uchar col) //inizializza stampante
{


disable_interrupts( global );

// tempo di attesa necessario per reset stampante
delay_ms(2000);


// seleziona colonne (0x69 x40col / 0x49 x24col)
if (col == 40)
{
putc (0x1B) ;
putc (0x69) ;
}
else if (col == 24)
{
putc (0x1B) ;
putc (0x49) ;
}


// seleziona la modalità di stampa capovolto
putc (0x1b) ;
putc (0x52) ;

enable_interrupts (global);

}



/////////

void main ( void )
{
initDevice () ;
initPrn (24);
..........

Why if I call the function initPrn(24), the device not answer at the serial interrupt ( INT_RDA )?
( I must use disable_interrupts ( global ) and enable_interrupts( global );
because the routines is software and it isn't always correct).

Thanks and sorry for my BAD ENGLISH . Shocked
DragonPIC



Joined: 11 Nov 2003
Posts: 118

View user's profile Send private message

When?
PostPosted: Wed Apr 14, 2004 10:11 am     Reply with quote

INT_RDA does not work after initPrn (24); has returned? Global enables or disables any and all interrupts. Have you used #USE RS232? Some of your code seems to be missing.

If you have 2 RS232 ports, you need a steam. See fgetc() and fputc
() in user manual.


and configure each port separately using:

#USE RS232 (baud=9600,xmit=pin,rcv=pin,stream=COM)

stream is to identify each port.
Franz
Guest







I use 232
PostPosted: Fri Apr 16, 2004 7:32 am     Reply with quote

Yes my funcion return in the main.
Yes i write #USE RS232 for configure each port separately but I don't USE stream. But i don't understand the manual, I write only 1 o two byte not a long string.
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