Hi! serial_software can't use interrupts. It is a "bit-bang" design which blocks the processor while sending data, or while waiting for incoming data.
If you're using a controller which doesn't have a usart peripheral and need to send or receive asynchronous serial signals without blocking, you would need to fire one interrupt per bit. There is no library which uses this approach, and it would also be of little use. One interrupt per bit means you can only use very low baud rates, unless your controller is a very fast one. And all the fast controllers do have usart peripherals. Greets, Kiste Am Sonntag, 18. April 2021, 21:15:21 MESZ hat majid ebru <[email protected]> Folgendes geschrieben: Hi i have two PIC16f877A. how can i use Interrupt for send& receive data between they?? i should use Serial_Software ------------ ;@jallib section chipdef -- chip setup include 16f877a pragma target clock 8_000_000 -- xtal frequency pragma target OSC hs pragma target WDT disabled pragma target LVP disabled enable_digital_io() include print include delay intcon_gie = true -- Enable interrupt generally -------------------------- Port A --------------------------------- const bit ADC_HIGH_rESOLUTION = low const word ADC_rSOUrCE = 2_000 const byte ADC_NVrEF = ADC_VrEF_POS--ADC_NO_EXT_VrEF--ADC_NO_VrEF-- and one Vref pin const byte ADC_NCHANNEL = 3 --- our 6 ADC channel include adc include math adc_init() var word ADC_Input_general_1 = 0 var word ADC_Input_general_2 = 0 var word ADC_Input_general_3 = 0 -------------------------------------------- ok, now setup serial alias serial_sw_tx_pin is pin_C4 alias serial_sw_rx_pin is pin_C5 pin_C4_direction = output const serial_sw_baudrate = 9600 var bit serial_sw_invert = false include serial_software serial_sw_init() -------------------------- Port B --------------------------------- alias in1 is pin_b0 pin_b0_direction = input -------------------------------- alias in2 is pin_b1 pin_b1_direction = input -------------------------------- alias in3 is pin_b2 pin_b2_direction = input -------------------------------- alias in4 is pin_b3 pin_b3_direction = input -------------------------------- alias in5 is pin_b4 pin_b4_direction = input -------------------------------- alias in6 is pin_b5 pin_b5_direction = input -------------------------- Port E --------------------------------- alias SS1 is pin_e0 pin_e0_direction = output SS1 = 0 -------------------------------- alias SS2 is pin_e1 pin_e1_direction = output SS2 = 0 -------------------------- Port D --------------------------------- alias Buzzer1 is pin_d1 pin_d1_direction = output Buzzer1 = 0 -------------------------------- alias FlashLED1 is pin_d2 pin_d2_direction = output FlashLED1 = 0 -------------------------------- alias Out_1 is pin_d3 pin_d3_direction = output Out_1 = 0 -------------------------------- alias Out_5 is pin_d4 pin_d4_direction = output Out_5 = 0 -------------------------------- alias Out_4 is pin_d5 pin_d5_direction = output Out_4 = 0 -------------------------------- alias Out_3 is pin_d6 pin_d6_direction = output Out_3 = 0 -------------------------------- alias Out_2 is pin_d7 pin_d7_direction = output Out_2 = 0 ------------------------------------------------------------------- var word n = 0 , j = 0 ------------------------------------------------------------------- var bit bitOut1 = 0, bitOut2 = 0 ------------------------------------------------------------------- var word press = 0 var word btnDelay = 500, btnDelay_1 = 0, btnDelay_2 = 0 var word btnDelay_3 = 0, btnDelay_4 = 0 var word buzDelay = 700, buzCount = 0 , sendByte = 0 var byte temp1 = 0 FlashLED1 = 1 --------------------------------------------------- >>> interrupt >>> ---- procedure ????? is pragma interrupt if ????? then block -- if recevive 10 => set Out_2 ?????????????? end block end if end procedure ------------------------------------------------------------------- forever loop ----------------------- Buzzer if buzDelay < buzCount then buzCount = 0 end if if 0 < buzCount then block Buzzer1 = 1 buzCount = buzCount + 1 end block else Buzzer1 = 0 end if ----------------------- btn1 if in1 == 1 then btnDelay_1 = btnDelay_1 + 1 else btnDelay_1 = 0 end if if btnDelay < btnDelay_1 then block buzCount = 1 btnDelay_1 = 0 Out_1 = 0 -- send Data to USART ????????????????? end block end if -------------------------------------------------- if n < 8000 then block n = n + 1 end block else block n = 0 FlashLED1 = ! FlashLED1 end block end if ----------------------- end loop ----------------------------------------------------------- please help or guide me -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/b69ef4ed-22dc-45d7-b710-f616ad6f3ed0n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/130784479.3597499.1618773938870%40mail.yahoo.com.
