Code:
' Compilation of this program requires that specific support files be ' available in the source directory. For detailed information, see ' the file PBP\USB18\USB.TXT. ' Config files for PIC18F4550 with 20 mhz crystal asm __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_ON_2L & _BORV_3_2L & _VREGEN_ON_2L __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _CCP2MX_ON_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L endasm DEFINE OSC 48 INCLUDE "cdc_desc.bas" 'Descriptor file for CDC serial demo ;--- Setup Interrupts ------------------------------------------------------ INCLUDE "DT_INTS-18.bas" ; Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts buffer Var Byte[16] cnt Var Byte ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler USB_INT, _DoUSBSERVICE, ASM, yes INT_Handler INT_INT, _Handle_INT, PBP, yes endm INT_CREATE ; Creates the Low Priority interrupt processor ;INT_ENABLE USB_INT ;we will do this after we initialize USB INT_ENABLE INT_INT ENDASM ;----[Initialise USB and Interrupts]---------------------------------------- PAUSE 100 ; Allow VUSB to stabilize USBINIT ; initialize the USB driver USBSERVICE ; service it once UIE = $7F ; enable USB interrupts UEIE = $9F ; enable USB Error interrupts @ INT_ENABLE USB_INT ;----[Main program loop]---------------------------------------------------- Main: cnt = 16 ' Specify input buffer size USBIn 3, buffer, cnt, main ' Message received buffer[0] = "H" buffer[1] = "e" buffer[2] = "l" buffer[3] = "l" buffer[4] = "o" buffer[5] = " " buffer[6] = "W" buffer[7] = "o" buffer[8] = "r" buffer[9] = "l" buffer[10] = "d" buffer[11] = 13 buffer[12] = 10 buffer[13] = 0 outloop: USBOut 3, buffer, 14, outloop GOTO Main ;----[Interrupt handler -- Service USB]------------------------------------- DoUSBSERVICE: USBSERVICE ; Run the SERVICE routines @ INT_RETURN ;----[Interrupt handler -- INT] Handle_INT: ; something here @ INT_RETURN
Re: Multiple PICs on usart network
test post to open a closed thread (I have a pending post)
Demon Today, 03:32can be deleted once another post is added (thread auto-closes if I remove this one)