CORRECTION TO CODE. Please ignore the code in previous post in favor of this one. Would really appreciate opinion as to whether this test code is telling me the MiniSocket has failed or not.
Code:
'<FL_PIC18F2550>' ' Set MCU type for FineLine Editor
'**************** Configure MCU and set port registers ********************
DEFINE OSC 48 ' Using 8 MHz crystal
@ __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L &_XINST_OFF_4L
TRISA = 0 ' Reserve PortA as outputs for LCD use
TRISB = %00011100 ' RB2 & RB3 reserved as RTC Alarm1 & Alarm2 inputs
' PORTB.2 is also an interrupt from manual switch GND
' PORTB.4 is set as A/D Channel 11 input
TRISC = %10000000 ' Set PortC to all outputs except PortC.7 which is
' reserved as RX input.
' PortC.1 is output for MSEL to WiFi module
' PortC.2 is used for the LCD R/W connection when
' LCD present..otherwise as _RES_PD to Wifi Module.
' PortC.4 is output to LED_RED
' PortC.5 is output to LED_GRN
'********************* Declare Variables and Aliases **********************
WRITE 2,2 'EEPROM test to see if program executes to here..it does
I VAR BYTE ' For-Next Loop index
LED_RED VAR PortC.4 ' Red LED
LED_GRN VAR PortC.5 ' Green LED used to indicate Routine entries
MSEL VAR PORTC.1 ' iChip Mode Select
_RES_PD VAR PORTC.2 ' iCHIP RESET/Power-Down
TX VAR PORTC.6 ' ports used for WiFi module serial interface
RX VAR PORTC.7
'X_TEMP VAR BYTE 'not used in new temperature routine
WRITE 3,3 'EEPROM test to see if program executes to here..it does
PAUSE 2000 'FOR SOME REASON PROGRAM DOESN'T EXECUTE PAST HERE IF STATEMENT IS UNCOMMENTED
WRITE 4,4 'EEPROM test to see if program executes to here..it doesn't if above statement uncommented!
' Blink LED_GRN 2X times to indicate iChip test started
FOR I = 0 TO 1
WRITE 5,5 'EEPROM test to see if program executes to here..it does
HIGH LED_GRN
PAUSE 500
LOW LED_GRN
PAUSE 500
NEXT
'***************** SETUP FOR USING iWiFi MiniSocket Module ***************
BOOT: 'iCHIP SET UP
HIGH _RES_PD ' Set high for normal ops
PAUSE 500 ' Delay to stabilize coming out of power down mode
LOW MSEL ' Exit SERIALNET mode and return iChip to normal AT+i mode
WRITE 6,6 'EEPROM test to see if program executes to here..it does
PAUSE 10000
HIGH MSEL ' Set high for normal AT+i ops
PAUSE 500
SEROUT2 TX,16390,[ "AT+iFD",$d ,$a] ' Reset iChip to factory defaults
SERIN2 RX ,16390,2500,BROKE,[ WAIT("I/OK")]
WRITE 7,7 'EEPROM test to see if program executes to here..it doesn't!
' ABOVE TEST INDICATES Interface to iChip is NOT working!
END
BROKE:
WRITE 16, "B" 'Record in EEPROM as test shows iChip broke
WRITE 8,8 'EEPROM test to see if program executes to here..it doesn't!
' Blink LED_RED 2X times to indicate iChip not working
FOR I = 0 TO 1
HIGH LED_RED
PAUSE 500
LOW LED_RED
PAUSE 500
NEXT
GOTO BOOT
Bookmarks