Dave, I began to wonder if in my process of converting your ConnectOne example code to my 16F886 MCU and my parsing of the code into subroutines that I could call from my application might have done something that screwed up its ability to communicate with the iChip module. So I went back to your original example code which is a lot simpler and modified it slightly so it is supposedly compatible with 16F886, without parsing into subroutines. Below is the resulting code where I have annotated where it stops and won't execute any further. Still looks like I can't get communication with the iChip. Would appreciate you trying it to see if you can get it to communicate with your module.
I also tried using the AT+iFD command to reset the iChip to Factory Defaults, in hopes that it would connect.....I did this because of this quote in the iChip WiFi Configuration Manual which says " Assuming all WiFi related parameters are cleared to their default value, as is the case after a Factory-Defaults setting (AT+iFD), iChip will attempt to associate and connect to the closest available Access Point (AP) that does not have any security configured. " I used this statement to try to do this and it won't even compile as if there is a syntax error: SEROUT2 TX,6 [ "AT+iFD",$d ,$a ] 'Set iChip to Factory Defaults
I don't see anything wrong with this. Any ideas why this won't compile?
'Adapted from http://mackrackit.com/mac/ichip/ichip.html
'Every 60 seconds OR so the PIC sends the commands TO the iChip TO FTP a file along with a new number in the file.
'Every 60 seconds OR so the page will reload with a new number generated by a PIC.
'Every 60 minutes OR so the DATA IS also emailed.
'The PIC code which will compile:
'#####################################
'< FL_PIC16F886 >' ' First valid PIC found within the first 200 lines will
' highlight AND set device.
'< FL_PBPW >' ' OR < FL_PBPL >
'< FL_MPASM >' ' OR < FL_PM >
' 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.4 = 0 ' Used as output for LED_GRN
TRISC.5 = 0 ' Used as output for LED_RED
TRISC.6 = 0 ' Used as output for serial TX
TRISC.7 = 1 ' Used as input for serial RX
' 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]
TX VAR PORTC.6
RX VAR PORTC.7
PAUSE 2000
BOOT: 'iCHIP SET UP
' Blink LED_GRN 1x LONG
HIGH PORTC.5 :PAUSE 1000
LOW PORTC.5: PAUSE 2000
'SEROUT2 TX,6 [ "AT+iFD",$d ,$a ] 'Set iChip to Factory Defaults
WRITE 2,2 'Above statement won't compile when uncommented
SEROUT2 TX,6,[ "AT+I",$d ,$a] 'Verify that the iChip is communicating
WRITE 3,3 'EEPROM test to see if program executes to here..it does.
SERIN2 RX,6,2500,BROKE,[ WAIT("I/OK") ]
WRITE 4,4 'EEPROM test to see if program executes to here..IT DOESN'T!
SEROUT2 PORTC.3 , 16780 , [ "iChip OK" ]
SEROUT2 PORTC.3 , 16780 , [ "TEST_" , DEC3 CNT , 13 , 10 ]
SEROUT2 TX ,6 , [ "AT+iIPA?" , $d , $a ] 'Report the current IP address
SERIN2 RX ,6 , 2500 ,BOOT , [ DEC ADR[0] , DEC ADR[1] , DEC ADR[2] , DEC ADR[3] ] 'Store IP in array
GOSUB DIP ' If IP address is empty, report not connected
PAUSE 2000
SEROUT2 TX,6,["AT+iWWW",$d,$a] 'Activate iChip s internal web server
SERIN2 RX,6,1000,BOOT,[WAIT("I/(")] ' 1 sec timout to BOOT label..I/(<Local IP addr>)where,<Local IP addr> IS the iChip local IP address
EMAIL_SET:
SEROUT2 TX,6,["AT+iSBJ:iChip ADC TEMPERATURE",$d,$a] 'Permanently sets Email header s Subject field
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iTOA:[email protected]",$d,$a] 'Permanently sets Email addressee
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+ito:jellis00",$d,$a] 'Permanently sets Email header s =To: description
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iREA:[email protected]",$d,$a] 'Permanently sets the RETURN EMAIL Address
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iFRM:iChip",$d,$a] 'Permanently sets Email header =From: description.
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMTP:mail.comcast.com",$d,$a]'Sets the SMTP Server Name or IP.
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMA=1",$d,$a] 'Permanently sets SMTP authentication method
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMP:Kevin111",$d,$a] 'Permanently sets authenticated SMTP login
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMU:[email protected]",$d,$a]'Permanently sets Authenticated SMTP login User Name.
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
FTP:
CNT = CNT + 1
FOR D_LAY = 1 TO 12
PAUSE 5000
NEXT D_LAY
IF CNT = 2 THEN EMAIL
IF CNT > 60 THEN CNT = 0
GOTO BOOT
END
EMAIL:
SEROUT2 TX,6,["AT+iEMA:",$d,$a] 'Defines a plain text e-mail body
SEROUT2 TX,6,["HI, THIS IS FROM 206 N Veterans.",$d,$a]
SEROUT2 TX,6,["SENT EVERY HOUR.",$d,$a]
SEROUT2 TX,6,["THE TEMPERATURE IS.",$d,$a]
SEROUT2 TX,6,[DEC temp," F Inside.",$d,$a]
SEROUT2 TX,6,["GO TO:",$d,$a]
SEROUT2 TX,6,["http://www.lodestarassoc.com/ichip/ichip.html",$d,$a]
SEROUT2 TX,6,["FOR A ONE MINUTE UPDATE.",$d,$a]
'After successfully sending the e-mail, IF the stay online flag (!) IS specified.
SEROUT2 TX,6,[$d,$a,".",$d,$a]
SERIN2 RX,6,[WAIT("I/ONLINE")]
PAUSE 1000
GOTO BOOT
DIP:
IF !ADR[1] AND !ADR[1] AND !ADR[2] AND !ADR[3] THEN SEROUT2 PORTC.3,16780,[" NOT "]
SEROUT2 PORTC.3,16780,[" CONNECTED ",$d,$a]
SEROUT2 PORTC.3,16780,["ADR - " ,DEC3 ADR[0],".",DEC3 ADR[1],".",DEC3 ADR[2],".",DEC3 ADR[3],$d,$a]
PAUSE 1000
RETURN
BROKE:
SEROUT2 PORTC.3 ,16780,["NOT WORKING",$d,$a]
PAUSE 500
GOTO BOOT
GET_T:
ADCON0=00000001
GOSUB READ_AD
temp = ADRESH
temp = temp * 2
RETURN
READ_AD:
PAUSE 50
ADCON0.2=1
WHILE ADCON0.2=1:WEND
RETURN
Bookmarks