Proton ile Sim800L kullanımı ile ilgili

Başlatan elektroacemi, 10 Ocak 2019, 14:28:20

elektroacemi

Merhalar.
Elimde Sim800L modül var. Denemek ve komut yapısını öğrenmek amaçlı Arduino ile kullandım. Bunu PIC ile kullanmak istiyorum. Proton ile bunu kullanmak için seri iletişim konutları kafamı karıştırdı.
Hardware serial mi?
Software serial mi?

Kullanmalıyım, birbirine göre avantaj ve dezavantajları neler. Önerilerinizi bekliyorum.

mustafa_cmbz

HARD serial kullanman protonda daha salıklı olur..

elektroacemi

11 Ocak 2019, 15:33:47 #2 Son düzenlenme: 11 Ocak 2019, 15:37:52 elektroakif
Teşekkür ederim.
Hard için aşağıdaki komutlar kullanılıyor diye anladım.

Declare Hserial_Baud = 9600
Declare Hserial_RCSTA = %10010000
Declare Hserial_TXSTA = %00100000
Declare Hserial_Clear = on

Hserial_Clear tam olarak ne için kullanılıyor.

t600

11 Ocak 2019, 16:23:54 #3 Son düzenlenme: 05 Kasım 2019, 13:53:47 muhittin_kaplan
daha önce sim 900a ile yaptım aynı .Bir php saypasına data gönderen program .  proton basic .


Device 16F887

    
'Stack_Size = 200 ' Create a small stack capable of holding 20 bytes

     
'  Config_Start
  ' 
CP0 On ' Code Protection Block 0 Disabled

'
CP1 On ' Code Protection Block 1 Disabled
'
CP2 On ' Code Protection Block 2 Disabled
'
CP3 On ' Code Protection Block 3 Disabled
'
CPB On ' Boot Block Code Protection Disabled
'
CPD On ' Data EEPROM Code Protection Disabled
  '
Config_End

  
' CCP1CON = %00001100     ' Set CCP1 to PWM
    
'T2CON = %00000101       ' Turn on Timer2Prescale=4
   
' PR2 = 149               ' Set PR2 to get 1KHz out
    
'Duty = 101           ' Set duty cycle to 20%

      
' PR2 = 249              ' Set PR2 to get 1KHz out
    
   
' CCP1CON.5 = Duty.1      ' a 10-bit word

     
'  CCPR1L = 255 

  '  
EWrite 104, [deger
   
'   ssp1 = ERead 54
    ;
; Config
'
@CONFIG_REQ
'@__CONFIG _CONFIG1, INTRC_OSC_NOCLKOUT & WDT_OFF & DEBUG_OFF & FCMEN_OFF & IESO_OFF & BOR_OFF & CP_On & MCLRE_ON & PWRTE_ON
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 '
@CONFIG_REQ
'@__CONFIG _CONFIG1, WDT_OFF & DEBUG_OFF & FCMEN_ON & IESO_ON & BOR_OFF & CPD_OFF & CP_OFF & MCLRE_ON & PWRTE_OFF & lvp_off 'FOSC1_OFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
' 10110011110101
'
111

 
Config
@CONFIG_REQ
'@__CONFIG _CONFIG1, INTRC_OSC_NOCLKOUT & WDT_OFF & DEBUG_OFF & FCMEN_OFF & IESO_OFF & BOR_OFF & CP_On & MCLRE_ON & PWRTE_ON
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 '
@CONFIG_REQ
@__CONFIG _CONFIG1INTRC_OSC_NOCLKOUT WDT_OFF DEBUG_OFF FCMEN_On IESO_Off BOR_Off CPD_off CP_off MCLRE_on PWRTE_OFF lvp_OFF 'FOSC1_Onn
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10110011110101
'111
'
Xtal 4
'OSCCON = %01110111

  Xtal = 8

 OSCCON = %11111010

All_Digital = TRUE
 
   TRISA = %11110111
   TRISB = %11111110
   TRISC = %10111111
   TRISD = %00000000
    TRISE = %1110    
      ' 
PORTA 0
  
' PORTB = 0
  ' 
PORTC 0
   
'PORTD = 0
  ' 
PORTE 0

  
     
' Symbol buz = PORTC.4

     
     ' 
ADCON0= %00001011  
     
' ADCON1 = %10001000 
   
         ' 
ADCON0= %00001011  
      
'ADCON1 = %10001111 
  
    Hserial_Baud = 9600 ' 
Set baud rate to 9600
 
'Hserial_RCSTA = %10010000 ' Enable serial port and continuous receive
'Hserial_TXSTA = %00100000 ' Enable transmit and asynchronous mode 
  Hserial_RCSTA 
= %10010000 ' Enable serial port and continuous receive
Hserial_TXSTA = %00100000 ' 
Enable transmit and asynchronous mode
Hserial_Clear 
On ' Optionally clear the buffer before receiving
   
      '
ADCON2 = %10010111   
LCD_DTPin 
PORTD.4
LCD_RSPin 
PORTD.0
LCD_ENPin 
PORTD.2
LCD_Interface 
4
LCD_Lines 
2
LCD_Type 
0
All_Digital 
True   

      PORTD.1 
0     ' ekran

   Dim SerData[100] As Byte        
  Dim a As Byte
   Dim gel[60] As Byte
   Dim say As Byte
  '
Declare CCP2_a PORTB.3
   
       
' Print At 1,1,  "devrtronik "
       
         bas:
     
                  Print At 2,1,  " Gcam control   "
        Print At 1,1,  "    T17-cont    "
             DelayMS 500
       
       
   
  '   
GoTo gg
       
               Cls
               
               
               
               hh
:
     
          
'        SerOut PORTE.0, 813, ["AT",13]
                  
  
              
                        '    
cls
                      
'  SerOut PORTE.0, 813, ["AT+CIPCLOSE=0",13]
                        '      
DELAYMS 500
                         
'gosub yaz
                         
                       
                         
                         
                                Cls
                           SerOut PORTE.0, 813, ["AT",13]
                               SerIn PORTE.1, 813, 5000, TimeoutError, [Wait("OK")]
                               Cls
                               Print "GSM BASARILI"
                                DelayMS 500
                         
                                     Cls
                           SerOut PORTE.0, 813, ["AT+CPIN?",13]
                         '  
GOSUB YAZ
                               SerIn PORTE.1
8135000TimeoutError, [Wait("+CPIN: READY")]
                               
Cls
                               
Print "SIM BULUNDU"
                                
DelayMS 500
                         
                                       Cls
                          SerOut PORTE.0
813, ["AT+CIPSHUT",13]
                               
SerIn PORTE.18135000TimeoutError, [Wait("SHUT OK")]
             
                               
Cls
                               
Print "CIP KAPATILDI"
                               
DelayMS 2000
                         
                              Cls
                             SerOut PORTE.0
813, ["AT+CGATT?",13]
                           
                              
SerIn PORTE.18135000TimeoutError, [Wait("+CGATT: 1")]
                              
                              
Cls
                               
Print "GPRS BAGLI"
                        
                                
DelayMS 500
                        
                                 Cls
                              SerOut PORTE.0
813, ["AT+CIPMUX=0",13]
                           
                              
SerIn PORTE.18135000TimeoutError, [Wait("OK")]
                              
                              
Cls
                               
Print "MUX"
                        
                                
DelayMS 500
                        
                                       Cls
                           SerOut PORTE.0
813, ["AT+CIPRXGET=1",13]
                           
                              
SerIn PORTE.18135000TimeoutError, [Wait("OK")]
                              
                              
Cls
                               
Print "MANUEL DATA ALIMI"
                        
                                
DelayMS 500
                   
                          

                                            Cls
                             SerOut PORTE.0
813, ["AT+CSTT=",34,"internet",34,44,34,34,44,34,34,13]
                      
                              
'SerIn PORTE.1, 813, 5000, TimeoutError, [Wait("OK")]
                              
                              Cls
                               Print "INTERNET OTURUMU"
                        
                                DelayMS 2000
                        
                                                 Cls
                                          
                             SerOut PORTE.0, 813, ["AT+CIICR",13]
                                 '  
SerIn PORTE.181310000TimeoutError, [Wait("+CIICR OK")]
                                    
' GOSUB YAZ
                            SerIn PORTE.1, 813, 10000, TimeoutError, [Wait("OK")]
                              
                              Cls
                               Print "GPRS OTURUMU"
                        
                                DelayMS 2000
                        
                                                         Cls
                                  SerOut PORTE.0, 813, ["AT+CIFSR",13]
                               GoSub yaz
                                 
                               DelayMS 2000
                              Cls
                               Print At 2,1, "IP ALINDI"
                        
                                DelayMS 1000
                        
                                       Cls
                               
               SerOut PORTE.0, 813, ["AT+CIPSTART=",34,"TCP",34,44,34,"www.gokdua.com",34,44,34,"80",34,13]
                              
                                 GoSub yazz  
                              ' 
SerIn PORTE.181320000TimeoutError, [Wait("CONNECT")]
                                      
Cls
                               
Print "BAGLANILDI"
                               
                               
                               
DelayMS 500
                              
'' GoTo hh
                               
                                 SerOut PORTE.0
813, ["AT+CIPSEND",13]
                                      
SerIn PORTE.181310000TimeoutError, [Wait(">")]
                                     Print 
"gidiiiiI"
                             
SerOut PORTE.0813, ["GET /defter.php?isim=picccccc HTTP/1.1",13,10]
                        
                        
                                 
SerOut PORTE.0813, ["Host: www.gokdua.com",13,10]
                                 
DelayMS 500
                                    SerOut PORTE.0
813, [13,10]
                                     
DelayMS 500
                                      SerOut PORTE.0
813, [13,10]
                                       
DelayMS 500
                                        SerOut PORTE.0
813, [26]
                                         
Cls
                                        
Print "olduuuuu" 
                                            
DelayMS 3000
                              
GoTo hh
                        
                        
                          Cls
                         
                           SerOut PORTE.0
813, ["AT+CIPMUX=1",13]
                          
                         
GoSub yaz
                          Cls
                                
                              SerOut PORTE.0
813, ["AT+CIPRXGET=1",13]
                             
                         
GoSub yaz
                          Cls
                           SerOut PORTE.0
813, ["AT+CSTT=",34,"internet",34,44,34,34,44,34,34,13]
                              
SerOut PORTE.0813, ["AT+CSTT=",34,"internet",34,44,34,34,44,34,34,13]
                         
GoSub yaz       
                          Cls 
                        
                              SerOut PORTE.0
813, ["AT+CIICR",13]
                             
                         
GoSub yaz
                          Cls
                           SerOut PORTE.0
813, ["AT+CIFSR",13]
                               
                         
GoSub yaz
                         
                                    
                               yyy
:
                               
                              
Cls
                           
                             SerOut PORTE.0
813, ["AT+CIPSTART=",34,"TCP",34,",",34,"www.gokdua.com",34,",",34,"80",34,13]
 
                         
GoSub yazz  
                               
                             
                               
                               
                              SerOut PORTE.0
813, ["AT+CIPSEND",13]
                               
                         
SerIn PORTE.181320000TimeoutError, [SerData[1]]
           Print  
SerData[1]
                         
DelayMS 2000      
                               
                          Cls
                           
                             SerOut PORTE.0
813, ["GET /defter.php?isim=pıcccccc HTTP/1.1",13]
                                   
SerOut PORTE.0813, ["Host: www.gokdua.com",13,13,13,13,26]
                         
GoSub yaz
                          
                                   DelayMS 3000            
                           
GoTo hh
                        
              
      
                    
        
                        
                    
GoTo hh
                   
                    
                    
                    
                    
                    
                    
                    
                    
                       DelayMS 3000
            
                   
                       
                                       Cls    
                                           
                                   
                                     
                       
                       
                       
                       
                       
                       
                       
                       DelayMS 3000
               
GoTo hh
               
               
               
                     SerOut PORTE.0
813, ["AT+CPIN?"]
                                     
DelayMS 100
                                     cpin
:
                                     For 
say 0 To 50
                                           SerIn PORTE.1
8135000TimeoutError, [SerData[say]]
                                          Print 
SerData[a]   
                                          
                                     
Next
                               
                                     Cls 
                                     
                                   
               
               
               
               
               
               
               
               
               
               
               
               
                      sim
:
        
        
         
SerOut PORTE.0813, ["OK"]
         
SerIn PORTE.18132000TimeoutError, [SerData[1]]
                               
SerIn PORTE.18132000TimeoutError, [SerData[1]]
           Print  
SerData[1]
              Print  
SerData[2]
           
DelayMS 3000
             Cls
        
GoTo sim       
               
               
               
               
               
               
                  simm
:
                             
SerIn PORTE.18132000TimeoutError, [SerData[1]]
                               
SerIn PORTE.18132000TimeoutError, [SerData[1]]
                                 
           Print  
SerData[1]
             Print  
SerData[2]
           
DelayMS 500
          Cls
              DelayMS 500
         
               
GoTo simm    
               
               
          
               
     
               
                
         
          
          
    
          
          
               
        
    
   okuma
:
      
HRSIn, {2000Timeout' Receive a byte serially into Var1
   If a = "$" Then
         
                       a = HRSIn, {1000, Timeout} ' 
Receive a byte serially into Var1
   
If "G" Then
        a 
HRSIn, {1000Timeout' Receive a byte serially into Var1
   If a = "P" Then
        a = HRSIn, {1000, Timeout} ' 
Receive a byte serially into Var1
   
If "R" Then
        a 
HRSIn, {1000Timeout' Receive a byte serially into Var1
   If a = "M" Then
        a = HRSIn, {1000, Timeout} ' 
Receive a byte serially into Var1
   
If "C" Then
         a 
HRSIn, {1000Timeout' Receive a byte serially into Var1
  If a = "," Then
       For say=0 To 59 
          gel[say] = HRSIn, {1000, Timeout} 
         ' 
if   gel[say] ="," then
          
'say = say - 1
          '
end if
         
' gel[say] = a
       Next
 
    
    
    For a= 0 To 16
   Print gel[a]
     ' 
Print At  1,a+1,  gel[a]
    
Next
     
' For a= 16 To 31
   ' 
Print gel[a]
      
'Print At 2,a+1,   gel[a]
   ' 
Next

          DelayMS 2000
              Cls
      End 
If 
            
End If  
          
End If  
            
End If  
              
End If  
                
End If  
                
End If 

   GoTo 
okuma 
    
    
        yazz

       
yazxx:              
      
'  SerIn PORTE.1, 813,6000, TimeoutError, [a]
       '  
if a13 or a=10 or a32 then
        
' goto yazx
         '
end if
                 
SerIn PORTE.181320000TimeoutError, [a]
                   
SerIn PORTE.181320000TimeoutError, [a]
                     
SerIn PORTE.181320000TimeoutError, [a]
                       
SerIn PORTE.181320000TimeoutError, [a]
                         
SerIn PORTE.181320000TimeoutError, [a]
                           
SerIn PORTE.181320000TimeoutError, [a]
                             
SerIn PORTE.181320000TimeoutError, [a]
                               
SerIn PORTE.181320000TimeoutError, [a]
                                 
SerIn PORTE.181320000TimeoutError, [a]
                                   
SerIn PORTE.181320000TimeoutError, [a]
                                     
SerIn PORTE.181320000TimeoutError, [a]
                                       
SerIn PORTE.181320000TimeoutError, [a]
                                         
SerIn PORTE.181320000TimeoutError, [a]
                                           
SerIn PORTE.181320000TimeoutError, [a]
                                             
SerIn PORTE.181320000TimeoutError, [a]
                                               
SerIn PORTE.181320000TimeoutError, [a]
                                                 
SerIn PORTE.181320000TimeoutError, [a]
                                                  
SerIn PORTE.181320000TimeoutError, [a]
                           
SerIn PORTE.181320000TimeoutError, [a]
                             
SerIn PORTE.181320000TimeoutError, [a]
                               
SerIn PORTE.181320000TimeoutError, [a]
                                 
SerIn PORTE.181320000TimeoutError, [a]
                                   
SerIn PORTE.181320000TimeoutError, [a]
                                     
SerIn PORTE.181320000TimeoutError, [a]
                                       
SerIn PORTE.181320000TimeoutError, [a]
                                         
SerIn PORTE.181320000TimeoutError, [a]
                                           
SerIn PORTE.181320000TimeoutError, [a]
                                             
SerIn PORTE.181320000TimeoutError, [a]
                        
                      
                
              For 
say=0 To 15
                  SerIn PORTE.1
8132000TimeoutError, [a]
         If 
a13 Or a=10 Or a32 Then
         Dec say
         
GoTo rrr
         End 
If
              Print 
At 1,say,  a
              rrr
:
            
Next          
                      
                              DelayMS 2000
                                 
Return
    
    
    
    
      
       
yaz
       
yazx:              
      
'  SerIn PORTE.1, 813,6000, TimeoutError, [a]
       '  
if a13 or a=10 or a32 then
        
' goto yazx
         '
end if
                 
SerIn PORTE.181320000TimeoutError, [a]
            
                
              For 
say=0 To 15
                  SerIn PORTE.1
8132000TimeoutError, [a]
         If 
a13 Or a=10 Or a32 Then
         Dec say
         
GoTo rr
         End 
If
              Print 
At 1,say,  a
              rr
:
            
Next          
                      
                              DelayMS 2000
                                 
Return
                                  
TimeoutError:
Print 
At 2,1,  "Timed Out"
DelayMS 500   
Return
GoTo 
bas 
                              
                              
                              
                              Cls
                              
                              
                         
    
    


Timeout
:
'Cls
Print "TIMED OUT" ' 
Display an error if Hrsin timed out
'Print At 2,1,  " Gcam control   "
DelayMS 1000
     Cls
   GoTo okuma
   Return
    
     
   End 

mustafa_cmbz

bunu böyle yapana kadar bi txt dosyası olarak paylaşaydın keşke..Program başında maşallah kaç kez konfig yazmışsınız..

elektroacemi

17 Ocak 2019, 13:05:56 #5 Son düzenlenme: 05 Kasım 2019, 13:54:09 muhittin_kaplan
Merhabalar.
Bir sorunum var. Gelen verimin uzunluğunu sürekli değişiyor.
Dim SerData[10] As Byte  '*** Örneğin burasını 10 karakter alacak şekilde tanımlıyorum

Again:
LEDS=0: LEDK=0
HSerIn 1000, TimeoutError, [Str SerData] '
*** Başka cihazdan 6 karakter yollayınca veriyi alıp ATLA kısmına 
GoTo ATLA                                  '*** geçmiyor, 7 karakter yollarsam geçiyor. Ne kadar karakter 
                                          '
*** gelirse o kadarını alıp diziye atmayı nasıl yapabilirim.
TimeoutError:
LEDS=1
Call  BEKLE
GoTo Again

ATLA
:

elektroacemi

17 Ocak 2019, 15:05:21 #6 Son düzenlenme: 05 Kasım 2019, 13:54:26 muhittin_kaplan
Aşağıdaki gibi çözdüm ama ne kadar sağlıklı olur bilmiyorum
Dim SerData[250] As Byte 
Dim SerData2
[250] As Byte 

Again
:
LEDS=1
Call   BEKLE
LEDS
=0LEDK=0

SerData
[0]="*"

HSerIn 1000 TimeoutError ,[Str SerDataStr SerData2

GoTo 
ATLA
TimeoutError
:
LEDS=1
Call   BEKLE
If SerData[0]="*" Then Again

ATLA
: