If you have in mind to use the downloaded software, the answer is IT WILL NOT WORK.I used the pins 10 & 12 of 16f690 instead of 17 & 18 of 16F873. Hope it will work
If you will write your own software the answer is YES IT WILL WORK.
Al.
If you have in mind to use the downloaded software, the answer is IT WILL NOT WORK.I used the pins 10 & 12 of 16f690 instead of 17 & 18 of 16F873. Hope it will work
If you will write your own software the answer is YES IT WILL WORK.
Al.
All progress began with an idea
With pic 16F690 you need to turn off analog port to make them digital. You will accomplish this with the following instruction:Any advise as to how to set up the registers, correctly for 690?
In my project I have used 8 ports as inputs and 8 ports as output. 690 doesn't have all these ports available, so you will decide how many inputs and how many outputs to use. Remember to set the TrisA; TrisB and TrisC registers accordingly.Code:ANSEL = 0 : ANSELH = 0
Al.
All progress began with an idea
Here is my code:
OSCTUNE=%01111 ' Oscillator 8MHz
intcon=0 ' Interrupts disabled
cm1con0=0 ' Comparator 1 disabled
cm2con0=0 ' Comparator 2 disabled
ansel=0 ' Pins to be Digital
anselh=0 ' Pins to be Digital
baud con 16468 ' baud rate = 9600 Inverted
trisc=%00000000 ' Port C I/O
trisb=%01111111 ' Port B I/O
trisa=%000000 ' Port A I/O
portc=0 ' Setting port c Low
portb=0 ' Setting port b Low
porta=0 ' Setting port a Low
i var byte ' Declaring variable
c var byte ' Declaring variable
tx var Portb.7 ' Declaring tx pin
rx var Portb.5 ' Declaring rx pin
Include "modedefs.bas"
main:
Serout2 tx,baud,["AT+CMGF=1",13]
gosub one
Serin2 rx,baud,5000,main,[wait("OK"),i]
gosub two
goto main
one:
for c=1 to 5
portc=255
pause 20
portc=0
pause 20
next c
return
two:
for c=1 to 5
portc=255
pause 400
portc=0
pause 400
next c
return
My Problems:
1) My led connected to portc only goes high ONCE in label one though it should enter label one every 5000mS.
2) It never enters label two as I assume there is somthign wrong in the communication part of PIC with the modem.
Please help me find out what am I doing wrong here?
It never enters label two as I assume there is somthign wrong in the communication part of PIC with the modem
Code:main: Serout2 tx,baud,["AT+CMGF=1",13] gosub one Serin2 rx,baud,5000,main,[wait("OK"),i] gosub two goto main
Remove the GOSUB One instruction! When you send an AT command to the modem, then you MUST immediatly switch to the SERIN2 instruction otherwise there is a high chance that the modem answer will be lost.
Edited:
Looking to the PBP manual the correct setting for 9600 bauds is 84 not 16468baud con 16468 ' baud rate = 9600 Inverted
Did you use the MAX232 for connecting Pic to modem?
Al.
Last edited by aratti; - 29th September 2009 at 18:26.
All progress began with an idea
Done it to 84, so now it is transmitting in True mode. NOW the code is entering gosub one as expected BUT not gosub two.
Changed the code to the following:
main:
gosub one
Serout2 tx,baud,["AT+CMGF=1",13]
Serin2 rx,baud,5000,main,[wait("OK"),i]
gosub two
goto main
As always code never enters label two which means it is not getting the required response. I attach my setup photo, though not very clear but the schematic is the same except the pin change to 10 & 12 instead of your 17 & 18.
Last edited by financecatalyst; - 29th September 2009 at 19:15. Reason: Adding more info
tc35i factory settings for bounrate is 2400 not 9600!
Becouse you use max its not inverted signal.
on 2400 and true settings should be 396 if you use 4mhz crystal.
here example of code how to star communication with modem if max232 is used:
Code:Init: serout tx,0,["AT",13] serin2 rx,396,1000,init,[WAIT("OK")]
Change your code as per the above, then it should work.Code:baud con 84 ' baud rate = 9600 Inverted Rx var Portb.7 ' Declaring rx pin Tx var Portb.5 ' Declaring tx pin
Edited:
Remember to allow the modem to settle after powerup, before start serial communication (See modem led blink)
Al.
Last edited by aratti; - 29th September 2009 at 19:49.
All progress began with an idea
Bookmarks