Autor Tema: Problema con el USART!!!!!!!!!  (Leído 2312 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado fvasquez

  • PIC10
  • *
  • Mensajes: 5
Problema con el USART!!!!!!!!!
« en: 24 de Febrero de 2004, 11:35:00 »
Hola a Todos:

Soy Felipe y estoy tratando de terminar mi proyecto de titulacion, es sobre localizacion de moviles mediante GPS y utilizo la red GSM para el envio de la informacion a una central (SMS), el asunto es que por el puerto hardware envio toda la informacion perfectamente, pero al tratar de recibir es donde no logro que funcione. Utilizo un 628 y tengo habilitado la interrupcion de puerto para la recepcion de la data.
Esto es parte del programa:

include "modedefs.bas"
DEFINE HSER_BAUD 9600
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h

  trisa =%00001100
  trisb =%00010011


    buffer var byte [80]    " bufeer de almacenamiento gps

OPTION_REG = %00000111                       " configuraciones varias
    INTCON = %00010000                       " Habilita GIE
      PIE1 = %00100000                       " Habilita Interrupcion por rx
     CMCON = 7                               " PortA = digital I/O
     VRCON = 0                               " A/D Voltage reference disabled
      TMR0 = 0


    hserout ["at+cmgf=1",10,13]
    pause 100
    on interrupt goto isr
    INTCON = %11010000

.
.
.
.
.

isr:disable
    if pir1.5 then rd
    goto e    
.
.
.

rd: buffer = rcreg
    hSERout [buffer]
    pie1.5 = 0
    goto e

e:  resume
     enable

si UDs. me pudiesen ayudar a encontrar el error, se los agradesco mucho....

De antemano Gracias.

Felipe

Desconectado Carlos_Gomez

  • PIC10
  • *
  • Mensajes: 9
RE: Problema con el USART!!!!!!!!!
« Respuesta #1 en: 24 de Febrero de 2004, 18:55:00 »
mira aqui , a lo mejor te sirve de algo, un saludo desde Tenerife   Carlos
http://www.picbasic.co.uk/forum/showthread.php?s=e8862c909140e0057ec06a5a79fb33f0&threadid=219


I have tried it using a NOKIA Phone and it works fine.

The Phone is connected to the HW-USART via MAX232
Baudrate: 9600 8N1

You need a clock spped of minimum 8MHz
(I"m using a 12MHz resonator)

-------------------------------------

DEFINE OSC 12

DEFINE HSER_TXSTA 20h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1

GSMBUFFER VAR BYTE[16]
Caller VAR BYTE[13]
GSMTime VAR BYTE[17]


"Send SMS Test-Message

HSerout ["ATZ",13,10]
Pause 1000

HSerout ["AT+CMGF=1",13,10] "Set Text Mode
Pause 500

HSerout ["AT+CMGS=",34,"+491232456789",34,",129",13,10]
Pause 500

HSerout ["Test-Message",10,13]
HSerout [26]
Pause 500

" Check for new incomming Messages

HSerout ["ATZ",13,10]
Pause 1000

HSerout ["AT+CMGF=1",13,10]
Pause 1000

Loop:

"List new Messages
HSerout ["AT+CMGL",13,10]

" Read Caller ID, time and 16 CHARs of Message

" The timeout value in the HSERIN statement is important, it takes some time before the phone replies to the AT+CMGL command

HSerin 5000,loop,[wait("UNREAD",skip 3,STR Caller13,skip 4,STR GSMTime17,skip 6, STR GSMBUFFER1613]

" --- Put your code to output the result here

" i.e. LCDOUT . . . .

Goto Loop:

-------------------------------------------------

There are certainly better ways to do the job, this was just a quick test and it works


Desconectado fvasquez

  • PIC10
  • *
  • Mensajes: 5
RE: Problema con el USART!!!!!!!!!
« Respuesta #2 en: 07 de Abril de 2004, 18:32:00 »
Gracias Carlos!!!!!!!!!!

Felipe.