I thought it was working...and it is to a point. However I am seeing an anomaly I can't understand. I hope you can help me figure this out.

I am programming my application with the below code using a PICKIT2. I have the PICKIT2 set to "VDD Target" so that the PICKIT2 is not providing power...my application has its own power.
The programming of the device is normal and it starts working and executes the program normally as long as the PICKIT2 is still connected (but not providing power).

However, when I disconnect the PICKIT2 and power down my application and then reapply the application's power, the code is obviously stopping execution at the point in the code where the AT+i coommand is given to set auto-baud at 9600 baud. I know this from the WRITE 4,4 statement not appearing in EEPROM after the test run and the LED_RED not blinking. However, when I then reconnect the PICKIT2 and load the PICKIT2 software with its screen, my application then works normally and executes the complete program with the LED_RED blinking as a heart beat during the BOOT loop.

It is almost like the iWiFi module isn't getting power when the PICKIT2 is disconnected and therefore the AT+iBDRA fails...but it is getting power...I checked with a voltmeter.
I am stumped and can't go any further in integrating this code with my overall application until I resolve this anomaly.

Do you or anyone have any ideas why the iWiFi module would act this way with this code and this scenario?? At least I was able to use this code when it worked while PICKIT2 was connected to identify the IP address, log into the iChip web server from my PC via the wireless route,r and set parameters on the iChip.

John


CODE]
'< FL_PIC16F886 >' ' First valid PIC found within the first 200 lines will
' highlight AND set device.
'< FL_PBPW >'
'< FL_MPASM >'
' Set configuration fuses for the MCU
' To use standard config include file, comment out below statement
@ __config _CONFIG1, _HS_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
ASM
ERRORLEVEL -306
ENDASM

DEFINE OSC 8
ADCON1 = %00001110
TRISC.1 = 0 ' Make pin output for MSEL
TRISC.2 = 0 ' Make pin output for _RES_PD

' Define variables and aliases
CNT VAR BYTE
CNT = 0
temp VAR BYTE 'Already declared in main program as temp
D_LAY VAR BYTE
ADR VAR BYTE [9]
MSEL VAR PORTC.1 ' iChip Mode Select (MSEL)
_RES_PD VAR PORTC.2 ' iCHIP RESET/Power-Down (_RES_PD)
TX VAR PORTC.6
RX VAR PORTC.7
PAUSE 2000
CLEAR
'Initialize iWiFi MiniSocket Module
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
PAUSE 5000 ' Delay 5 sec
HIGH MSEL ' Proceed with normal AT+i command ops
PAUSE 2000 ' Delay 2 sec

BOOT: 'iCHIP SET UP
WRITE 3,3 'EEPROM test to see if program executes to here..it does under all conditions.
SEROUT2 TX,84,["AT+iBDRA",$d,$a] ' FORCE ICHIP TO AUTO BAUD
SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")] ' SETTING BAUD TO 9600
PAUSE 100
WRITE 4,4 'EEPROM test to see if program executes to here..it does when
'application is connected to PICKIT2
but DOESN'T when
'disconnected and then started on application's own power.
'However when reconnected to PICKIT2 and the PICKIT2 screen
'is then opened, it executes normally again.
PICKIT2 is set to
'VDD target and is not supplying power to the application.
HIGH PORTC.4 :PAUSE 500 ' Short Blink the LED_RED as heart beat
LOW PORTC.4: PAUSE 500 ' during BOOT loop. Doesn't Blink when
' disconnected from PICKIT2!
SEROUT2 TX,84,["AT+iRPG=booger",$d ,$a] ' SETS REMOTE PASSWORD
SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
PAUSE 100
WRITE 5,5 'EEPROM test to see if program executes to here..it does!
'SEROUT2 TX,84,["AT+iWSEC=0",$d ,$a] ' WPA-TKIP PROTOCAL
' Commented out until WPA setup on wireless router
'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
PAUSE 100
SEROUT2 TX,84,["AT+iWLSI=Buckskin",$d,$a]' SET SSID WE ARE LOOKING FOR
SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")] '
PAUSE 100
'SEROUT2 TX,84,["AT+iWLPP=macmac3X3",$d,$a]' SET PASS-PHRASE
' Commented out until WPA setup on wireless router
'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
PAUSE 100
SEROUT2 TX,84,["AT+i!RP10",$d,$a] ' REPORTS CONNECTION PARAMETERS
SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")] ' FOR DEBUGGING
PAUSE 100
SEROUT2 TX ,84,[ "AT+iIPA?" , $d , $a ] ' RETURNS IP ADDRESS
' FOR DEBUGGING
SERIN2 RX ,84 , 2500 ,BOOT , [ DEC ADR[0] , DEC ADR[1] , DEC ADR[2] , DEC ADR[3] ]
PAUSE 100
WRITE 6,6 'EEPROM test to see if program executes to here..it does!
SEROUT2 TX,84,["AT+iWWW",$d,$a] ' STARTS iChip WEB SERVER
SERIN2 RX,84,1000,BOOT,[WAIT("I/(")]
WRITE 7,7 'EEPROM test to see if program executes to here..it does!
PAUSE 100
GOSUB Blink ' IF WE GET HERE BLINK LED_GRN
PAUSE 100
WRITE 16,ADR[0] ' Write the IP to EEPROM for post run identify
WRITE 17,ADR[1] ' Use PC host to then go to iChip web server at
WRITE 18,ADR[2] ' http:ADR[0].ADR[1].ADR[2].ADR[3] and set all
WRITE 19,ADR[3] ' desired iChip parameters for operations
GOTO BOOT
Blink:
HIGH PORTC.5 :PAUSE 500 ' Short Blink the LED_GRN..IT DOES AFTER ~1 minute!
LOW PORTC.5: PAUSE 500
RETURN
[/CODE]