Quote Originally Posted by mackrackit View Post
Does the PIC run without the PicKit2?
Do a blinky to verify.
I created a set of code that is the same as above post down through the _RES_PD and MSEL initialization followed only by a mainloop that blinks the LED. I did this so that all the setup code I was using was still the same in this test. This blinky code works whether the PICKIT2 is connected or not, so that didn't ID the problem.
The Sparkfun device looks like it requires 5 and 3 volts.
Do you have both?
Yes. Actually I have the iWiFi module running on 3.32 volts which is within its required Vdd range, so the lov voltage side of the Sparkfun converter is at 3.32v.
Do they share a ground, VSS ?
Yes, I created a large ground plane layer on the top layer of my PCB right below the iWiFi module's outline where it is mounted to the PCB and this ground plane is shared with the level converter, the PIC and the rest of the PCB circuit.

Do you have capacitors near the PIC across VDD and VSS?
Yes, I have a 10uf tantalum and a 0.1uf ceramic connected near Vdd on the PIC to the Vss.

Did you change the backup battery problem?
Yes, after I cut the traces to the pull-ups and greenwired them to Vcc I then replaced the backup battery and the clock is running fine and maintaining time.

These were all good questions and I appreciate you making me think through this. The bad news is that the code still quits running when the PICKIT2 is disconnected. However the good news is that I am now sending and receiving an email from the ichip (but only when the PICKIT2 is connected). Still trying to figure out the AT+i commands and right sequence of WAITs to only send one email when I want to. At this time for some reason it is sending two emails one minute apart repeated every 8 minutes. I thought I had the timing in this code set to only send one every 5 minutes and don't see where this is causing the repeats at the wrong interval. I only want it to send one every 5 minutes. I don't think I have the WAIT statements for I/OK, I/DONE, and I/ERROR correct and the timeouts to the EMAIL label may be causing repeated emails. Here is the EMAIL routine code I am using....any suggestions?

Code:
    EMAIL_SET:
        SEROUT2 TX,84,["AT+iSBJ:iChip ADC TEMPERATURE",$d,$a] 'Permanently sets Email header Subject field
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iTOA:[email protected]",$d,$a]  'Permanently sets Email addressee
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+ito:jellis00",$d,$a]      'Permanently sets Email header =To:  description
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iREA:[email protected]",$d,$a] 'Permanently sets the RETURN EMAIL Address
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iFRM:iChip",$d,$a]        'Permanently sets Email header =From: description.
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iSMTP:smtp.comcast.net",$d,$a]'Sets the SMTP Server Name or IP.
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iSMA=1",$d,$a]            'Permanently sets SMTP authentication method
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iSMP:Kevin111",$d,$a]     'Permanently sets authenticated SMTP login
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        SEROUT2 TX,84,["AT+iSMU:je.lodestar",$d,$a]  'Permanently sets Authenticated SMTP login User Name.
        SERIN2 RX ,84,2500,EMAIL_SET,[WAIT("I/OK")]
        GOSUB Blink_GRN        ' Short blink the LED_GRN if gets to here
        CNT = CNT + 1
        FOR D_LAY = 1 TO 12    ' Delay for 1 min
            PAUSE 5000
        NEXT D_LAY
        IF CNT > 4 THEN        ' Execute if 5 minutes have passed
           FOR I = 0 TO 1      ' Long Blink LED_GRN 2x if gets to here
               HIGH PORTC.5
               PAUSE 2000
               LOW PORTC.5
               PAUSE 2000
           NEXT
           GOSUB GET_T
           GOSUB EMAIL         ' Send an email every 2 minutes
           CNT = 0             ' Reset CNT after 2 minutes
        ENDIF
        PAUSE 2000
        GOTO BOOT
    END          ' To protect code from going to never-never-land
    
    EMAIL:
        SEROUT2 TX,84,["AT+iEMA:",$d,$a]  'Defines a plain text e-mail body
        SEROUT2 TX,84,["HI, THIS IS FROM 206 N Veterans.",$d,$a]
        SEROUT2 TX,84,["SENT EVERY HOUR.",$d,$a]
        SEROUT2 TX,84,["THE TEMPERATURE IS.",$d,$a]
        SEROUT2 TX,84,[DEC temp," F Inside.",$d,$a]
        SEROUT2 TX,84,["GO TO:",$d,$a]
        SEROUT2 TX,84,["http://www.lodestarassoc.com/ichip/ichip.html",$d,$a]
        SEROUT2 TX,84,["FOR A ONE MINUTE UPDATE.",$d,$a]
        SEROUT2 TX,84,[$d,$a,".",$d,$a]
        SERIN2 RX ,84,2500,EMAIL,[WAIT("I/OK")]
           GOSUB Blink_GRN  ' Short blink LED_GRN 3x
           GOSUB Blink_GRN
           GOSUB Blink_GRN
           PAUSE 1000
           GOTO Sent
        SERIN2 RX ,84,2500,EMAIL,[WAIT("I/ERROR")]
           GOSUB Blink_RED  ' Short blink LED_RED 3x
           GOSUB Blink_RED
           GOSUB Blink_RED
           PAUSE 1000
        SERIN2 RX,84,2500,EMAIL,[WAIT("I/DONE")]
        PAUSE 2500  ' After successfully sending the e-mail, allow 2.5 seconds
         'delay for iChip re-initialization following an Internet mode session.
           GOSUB Blink_GRN  ' Short blink LED_GRN 4x
           GOSUB Blink_GRN
           GOSUB Blink_GRN
           GOSUB Blink_GRN
           PAUSE 1000
        Sent:    ' Label for GOTO after email is sent to skip other WAIT checks.
     RETURN