I used a hand-compiled statement in assembly for a large switch statement in the CCS compiler. This is a routine to send one bit of an IrDA compatible infrared signal. It's called 19200 times per second; other code turns off the bit after a short (1 or 2 microsecond) delay, and refills the "char_to_send". If your code has varying lengths, a jump table might be a better alternative. #inline void send_ir() { //if (bit_to_send > 27) bit_to_send = 0; pclath = 0; //because this code is within the global interrupt routine #asm movf bit_to_send,w addwf pcl,f nop bsf portc.tx goto end btfss char_to_send,0 bsf portc.tx goto end btfss char_to_send,1 bsf portc.tx goto end btfss char_to_send,2 bsf portc.tx goto end btfss char_to_send,3 bsf portc.tx goto end btfss char_to_send,4 bsf portc.tx goto end btfss char_to_send,5 bsf portc.tx goto end btfss char_to_send,6 bsf portc.tx goto end btfss char_to_send,7 bsf portc.tx goto end clrf bit_to_send clrf char_to_send goto exit #endasm end: bit_to_send+=3; exit: return; } ----- Original Message ----- From: "Thys" To: Sent: Wednesday, January 22, 2003 10:40 AM Subject: [PIC] HT-PIC and large switch statements? > Hi, > I want to re-use old code that contains large switch-statement with about > 30 cases consecutively numbered 0,1,2... > > HT-PIc ver 7.8 compiler implemented this as a jump table. > With v 8.01 it is done as a sequence of tests. Net result is that time > taken to execute cases at the end is far to long now, and code does not > work any more. > Is there a way to force creation of a jump table , or other coding methode > ( inline assembler ??) > > > > Any ideas ? > > Thys > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads