Escolar Documentos
Profissional Documentos
Cultura Documentos
- ii -
____________________________________________
_____________________________________
Ledilson de Oliveira Barbosa Filho
_____________________________________
Paulo Roberto Floriano
- iii -
Banca Examinadora:
_______________________________________________________________
Prof. Denir Valencio de Campos, M.Sc. (PEB/COPPE/UFRJ)
_______________________________________________________________
Prof. Felipe Aurlio Caetano de Bastos, D.Sc. (PEE/COPPE/UFRJ)
_______________________________________________________________
Prof. Fernando Antnio Tupinamb Barbosa, M. Sc. (PUC/RJ)
- iv -
EPGRAFE:
-v-
DEDICATRIA
Dedicamos este projeto a todos aqueles que nos apoiaram e nos ajudaram
desde o incio do nosso percurso. Primeiramente a Deus, por ter nos dado foras e
sabedoria no decorrer de nossa jornada. A nossas famlias, que sempre estiveram ao nosso
lado, servindo de alicerces para nos sustentar e no nos fazer desanimar em tempo algum.
UniverCidade, como entidade educacional, por acreditar na capacidade de seus alunos,
fazendo-nos caminhar para a concluso do curso com xito. Aos nossos colegas e amigos,
pelo apoio e confiana depositados em ns para que atingssemos nossos objetivos. Aos
professores, em especial, ao nosso orientador Denir Valncio, pois sempre caminharam
lado a lado conosco, guiando-nos durante todos os perodos, enchendo-nos de
conhecimentos. Obrigado a todos.
- vi -
AGRADECIMENTOS
A Deus por nos ter iluminado durante todos estes anos e nos dado sade,
perseverana,
Tranqilidade e equilbrio durante toda esta caminhada.
Aos nossos Pais e familiares que nunca mediram esforos para nos ajudar,
incentivar e contribuir com esta conquista to expressiva para o nosso saber.
Aos nossos amigos de graduao, que nos ajudaram durante essa longa
caminhada.
- vii -
Resumo
O presente trabalho apresenta o desenvolvimento de um sistema telemtrico
para controle contbil e logstico do estoque distncia de uma mquina automtica de
vendas utilizando tecnologia GPRS. O principal estudo deste projeto est focado no
microcontrolador PIC e suas caractersticas, assim como o desenvolvimento total do
prottipo que resultou tambm em abranger as tecnologia GSM e GPRS e a pilha de
protocolos TCP/IP.
Desenvolveu-se tambm um detalhamento do funcionamento do hardware e
do software do prottipo assim como os resultados obtidos e as possveis alteraes para
projetos futuros.
Sumrio
EPGRAFE: ......................................................................................................................... v
DEDICATRIA ................................................................................................................. vi
AGRADECIMENTOS ...................................................................................................... vii
Captulo 1 Introduo ....................................................................................................... 14
1.1
Telemetria................................................................................................................. 14
Microcontroladores ................................................................................................. 17
-x-
Lista de Figuras
Figura 2. 1. Arquitetura de Von Neumman .................................................................... 19
Figura 2. 2. Arquitetura do microcontrolador PIC........................................................ 19
Figura 2. 3. Pipeline no microcontrolador PIC .............................................................. 20
Figura 2. 4. Mapa de registradores .................................................................................. 21
Figura 2. 5. Comparao entre os modelos TCP e OSI ................................................. 24
Figura 3. 1. Topologia do sistema..................................................................................... 35
Figura 3. 2. Circuito Multiplexador................................................................................. 36
Figura 3. 3. Diagrama de blocos do circuito multiplexador .......................................... 37
Figura 3. 4. Kit de desenvolvimento acadmico de fabricao CERNE....................... 38
Figura 3. 5. Diagrama do PIC 16F876A .......................................................................... 40
Figura 3. 6. Diagrama 1 de comunicao serial .............................................................. 41
Figura 3. 7. Diagrama 2 de comunicao serial .............................................................. 41
Figura 3. 8. Diagrama do regulador de tenso................................................................ 41
Figura 3. 9. Diagrama dos terminais do mdulo Sim 340Z e GPRS............................. 43
Figura 3. 10. Diagrama do Led de controle..................................................................... 44
Figura 3. 11. Diagrama do mdulo Sim card .................................................................. 44
Figura 3. 12. Tela inicial do servidor CVA ..................................................................... 45
Figura 3. 13. Parque de mquinas ................................................................................... 45
Figura 3. 14. Tela de controle de uma mquina no servidor ......................................... 46
Figura 3. 15. Tela de controle de venda e recarga de produtos..................................... 46
Figura 3. 16. Estrutura do protocolo de transmisso..................................................... 47
Figura 3. 17. Estrutura do protocolo de recarga ............................................................ 48
- xi -
Lista de Tabelas
Tabela 2. 1. Camadas de aplicao TCP/IP .................................................................... 26
Tabela 2. 2. Componentes de interface ............................................................................ 27
Tabela 3. 1. Caractersticas do PIC ................................................................................. 39
Tabela 3. 2. Componentes de interface 2 ......................................................................... 47
Tabela 3. 2. Componentes de interface 3 ......................................................................... 48
- xii -
CDMA
CI
CMOS
Circuito Integrado
Complementary Metal-Oxide-Semiconductor (Semi condutor
de metal-xido complementar)
CPU
CSD
CVA
FDMA
GPRS
GSM
I/O
IP
OSI
PIC
RAM
RISC
SMS
TCP
TDMA
TTL
- xiii -
Captulo 1 Introduo
Apesar do mercado brasileiro ainda estar muito retrado no que diz respeito
a sistemas de telemetria, ocasionando alguns retardos na sua expanso devido s
dificuldades de uma soluo que possa atender inmeros setores causando com isso custos
ainda elevados para algumas aplicaes, a necessidade cada vez maior de se explorar os
avanos tecnolgicos do sistema de telecomunicaes no Brasil e no mundo, voltados para
transmisso remota de dados no podem ser ignorados, pois est se tornando gradualmente
um recurso fundamental para vrios setores. A grande gama de mquinas que so
desenvolvidas a cada dia utilizando algum tipo de microcontrolador com a tarefa de
monitorar e controlar sistemas cresce progressivamente. Agregado a estas, est o gasto
com visitas para superviso, controle manual e custos com visitas preventivas, com isso, se
verifica a necessidade de uma comunicao instantnea com estas mquinas tornando,
desta atitude, um fator estratgico para a sobrevivncia em mercados cada vez mais
competitivos.
1.1 Telemetria
Telemetria uma tecnologia que permite medio e comunicao
distncia de reas remotas com uma central de captao de informaes, e uma palavra
grega onde tele = remoto e metron = medida. Definimos ento telemetria como a
transferncia e utilizao de dados provindos de mltiplas mquinas remotas distribudas
em uma rea geogrfica de forma pr-determinada. Uma sute operacional que envolve
telemetria composta de recursos humanos e fsicos capaz de realizar a transferncia e
utilizao de dados provindos de equipamentos remotos para o monitoramento, medio e
controle dos mesmos [1][2].
- xiv -
1.2 Objetivo
Este trabalho tem o objetivo de desenvolver um projeto baseado em
conceitos e aplicaes telemtricas com respaldo nos conhecimentos da engenharia de
telecomunicaes, visando criar uma soluo inovadora no controle de mquinas
automticas de venda.
15
captulo
abordado
um
referencial
terico
sobre
os
16
de
tomadas
de
deciso,
que
so
conseguidas
com
estes
17
18
19
20
21
22
23
O modelo OSI faz uma explcita distino entre estes conceitos bsicos. As
camadas inferiores fornecem alguns servios para as superiores. Na definio de servio,
especifica-se o que cada camada faz, no diz como as camadas acima acessam e como ela
trabalha. H uma interface de camada que diz aos processos acima como acess-lo,
especificando os parmetros e os retornos esperados, mas no fala sobre o funcionamento
interno da camada. Os protocolos pares usados na camada, so assuntos prprios da
24
camada. Ela pode usar quaisquer protocolos, desde que fornea o servio requerido.
Tambm pode mud-los sem afetar o software nas camadas mais altas [7]-[8]-[9].
Estas idias so muito prximas s modernas idias de programao
orientada a objeto. Cada objeto (camada) tem um conjunto de mtodos que podem ser
acessados por processos externos ao objeto. A semntica destes mtodos define o conjunto
de servios oferecidos pelo objeto. Os parmetros dos mtodos e os resultados da interface
do objeto. O cdigo interno do objeto seu protocolo e no visvel fora deste.
O modelo TCP/IP originalmente no faz esta clara distino entre servio, interface e
protocolo, embora muitos tenham tentado mud-lo para torn-lo mais parecido com OSI.
Por exemplo, os nicos servios reais oferecidos pela camada de internet so enviar e
receber pacote IP. Por esta razo, os protocolos OSI so mais bem escondidos do que no
TCP/IP e tm maior adaptabilidade para mudanas de tecnologia. Esta adaptabilidade um
dos propsitos principais de se ter protocolos por camadas no modelo inicial [7]-[8]-[9].
O modelo de referncia OSI foi criado antes da inveno dos protocolos.
Desta forma ele no foi feito sobre um conjunto particular de protocolos, o que o torna
bem geral. Isto significa que o modelo no foi formado sobre um conjunto particular de
protocolos, o que o faz ser bem geral. Em contraponto, os projetistas no tinham muita
experincia e no poderiam ter uma boa idia quanto funcionalidade das camadas. Por
exemplo, originalmente a camada de enlace lidava somente com redes ponto a ponto e
quando ento surgiram as redes, teve de ser adicionada uma nova subcamada. Quando as
pessoas passaram a construir redes usando o modelo OSI e protocolos existentes,
descobriram que eles no atendiam as especificaes de servio requeridas e tiveram de
adicionar subcamadas para superar as diferenas. Finalmente, o comit originalmente
esperou que cada pas tivesse uma rede, gerenciada pelo governo e usando os protocolos
OSI, logo a idia de interconectividade. Resumidamente, as coisas no aconteceram assim
[7]-[8]-[9].
Com o TCP/IP aconteceu o contrrio: os protocolos vieram primeiro, e o
modelo foi apenas uma descrio dos protocolos existentes. Por isso no houve problema
com protocolos tendo que se adaptarem ao modelo, eles se encaixam perfeitamente. O
problema que nem toda pilha de protocolo se encaixa no modelo. Conseqentemente, no
podia ser utilizado para descrever redes que no fossem TCP/IP. Falando mais especificamente, h uma diferena bvia entre os dois modelos que o nmero de camadas: OSI
tem sete e o TCP/IP tem quatro. Ambas tm camada de rede, de transporte e aplicao,
25
mas as outras so diferentes. Outra diferena est ligada ao tipo conexo da comunicao:
comunicao sem conexo (CSC) versus comunicao orientada conexo (COC). Na
camada de rede, OSI suporta ambos e o modelo TCP/IP tem somente um modo. Na
camada de transporte, OSI possui somente COC, onde ele influencia (porque o servio de
transporte visvel aos usurios), enquanto que TCP/IP suporta ambos os modos na
camada de transporte, dando uma escolha aos usurios. Esta escolha especialmente
importante
para
protocolos
simples
de
pergunta
resposta
[7]-[8]-[9].
3. Transporte
TCP, UDP
2. Rede
IP
1. Enlace
26
DNS, Sockets
Rede / Enlace
ARP, DHCP
2.3 As camadas
2.3.1 Camada de enlace
Os protocolos de enlace tm a funo de fazer com que informaes sejam
transmitidas de um computador para outro em uma mesma mdia de acesso compartilhado
(tambm chamada de rede local) ou em uma ligao ponto-a-ponto (ex: modem). A
preocupao destes protocolos permitir o uso do meio fsico que conecta os
computadores na rede e fazer com que os bytes enviados por um computador cheguem a
um outro computador diretamente desde que haja uma conexo direta entre eles [8]-[9].
27
modo que o TCP/IP saiba para qual programa entregar cada mensagem recebida pela rede
[8]-[9].
28
concorrente CDMA. A performance dos celulares muito similar, mas apesar disso o
sistema GSM tem mantido compatibilidades com os telefones GSM originais. A verso de
1999 do padro introduziu ndices relativamente altos de transmisso de dados, e
normalmente referida como 3G. O sistema GSM 900 utiliza dois conjuntos de freqncias
na banda dos 900 MHz, o primeiro nos 890-915MHz, utilizado para as transmisses do
terminal e o segundo nos 935-960MHZ, para as transmisses da rede [11]-[12].
O mtodo utilizado pelo GSM para gerir as freqncias uma combinao
de duas tecnologias: o TDMA (Time Division Multiple Access ou Acesso Mltiplo por
Diviso de Tempo) e o FDMA (Frequency Division Multiple Access ou Acesso Mltiplo
por Diviso de Freqncia). O FDMA divide os 25 MHz disponveis de freqncia em 124
canais com uma largura de 200 kHz e uma capacidade de transmisso de dados na ordem
dos 270 Kbps. Uma ou mais destas freqncias atribuda a cada estao base e dividida
novamente, em termos de tempo, utilizando o TDMA, em oito espaos de tempo
(timeslots). O terminal utiliza um timeslot para recepo e outro para emisso. Eles
encontram-se separados temporalmente para que o telemvel no se encontre ao receber e
transmitir ao mesmo tempo. Esta diviso de tempo tambm chamada de full rate. As
redes tambm podem dividir as freqncias em 16 espaos no processo designado de half
rate, mas a qualidade da transmisso inferior [11]-[12].
A voz codificada de uma forma complexa, de forma que erros na
transmisso possam ser detectados e corrigidos. Em seguida, enviado nos timeslots, cada
um com uma durao de 577 milisegundos e uma capacidade de 116 bits codificados. Cada
terminal possui uma agilidade de freqncia, podendo deslocar-se entre os timeslots
utilizados para envio, recepo e controle dentro de um frame completo. Ao mesmo tempo,
um telemvel verifica outros canais para determinar se o sinal mais forte e mudar a
transmisso para os mesmos, caso a resposta seja afirmativa [11]-[12].
29
30
pode
ser
compartilhado
concorrentemente
entre
vrios
usurios.
Esse uso eficiente de recursos significa que um grande nmero de usurios GPRS pode
potencialmente compartilhar a mesma largura de banda e serem servidos de uma nica
clula [11]-[12].
O nmero atual de usurios suportados depende da aplicao em uso e de
quanta informao est sendo transferida. Dada eficincia do GPRS, h menor necessidade
de investir em recursos que sero somente utilizados em horrios de pico. Portanto, o
GPRS permite que as operadoras maximizem o uso de seus recursos de rede de uma forma
dinmica e flexvel [11]-[12].
O GPRS pode melhorar a capacidade de uma rede GSM, pois,
simultaneamente aloca recursos de rdio pouco abundantes de forma mais eficiente por
suportar conectividade virtual, migra trfego anteriormente enviado atravs de CSDs para
GPRS e reduz o uso de canais de sinalizao atravs da migrao de trfego que
anteriormente era enviado via SMS para GPRS, ao invs de usar a conectividade GPRS /
SMS suportada pelo padro GPRS [11]-[12].
O GPRS permite uma funcionalidade completa no que se refere Internet
Mvel por disponibilizar interoperabilidade entre a Internet existente e as novas redes
GPRS. Qualquer servio atualmente utilizado na Internet como FTP, navegao na Web,
31
chat, email, estar tambm disponvel atravs da rede mvel com o GPRS. Na verdade,
muitas operadoras esto considerando a oportunidade de usar GPRS como forma de ajudar
a se tornarem Provedores de Servio Internet (ISP) [11]-[12].
A World Wide Web est se tornando a primeira escolha das pessoas que
desejam acessar a Internet para entretenimento e coleta de informaes, a intranet para
acessar informaes da companhia e conexo com colegas de trabalho e a extranet para
acessar clientes e fornecedores. Tudo isso deriva da World Wide Web com o intuito de
conectar comunidades com interesses diversos. H uma tendncia em se armazenar
informaes localmente por meio de pacotes de software especficos e acessar essas
informaes remotamente, via Internet [11]-[12].
32
33
na mquina de vendas. Estas duas solues sero interligadas atravs de conectores tipo
encaixe montados na placa de interface e na placa cerne na sada do microcontrolador.
Aps executada esta tarefa, finalmente estes dados sero recebidos via internet para um
servidor desenvolvido com a linguagem de programao Visual Basic 6.0 que interagindo
com um banco de dados, tratar e organizar todos os eventos para posterior emisso de
relatrios de controle de fluxo.
Para realizao do nosso projeto optamos por adquirir um kit de
desenvolvimento de fabricao da Cerne modelo SIM 340Z. Tal opo deve-se
principalmente pelas conexes do mdulo GPRS com o SIM Card e o microcontrolador
PIC que so de difcil execuo fora de um laboratrio devidamente equipado. Porm, tal
kit vem com diversas funcionalidades que no esto sendo utilizadas nesse projeto
conforme veremos a seguir e devem ser desconsideradas.
34
35
36
37
Regulador de tenso
Comunicao serial
Display de LCD
Conversor A/D
Mdulo GPRS
Teclado matricial
Dois rels
Regulador de tenso
Comunicao serial
Quatro leds
38
Mdulo GPRS
Pacotes
PIC16F876A
DC 20 MHz
POR, BOR (PWRT,
OST)
8K
368
256
14
Ports A, B, C
3
2
MSSP, USART
5 canais de
entrada
2
35 Instrues
28-pin PDIP
28-pin SOIC
28-pin SSOP
28-pin QFN
39
41
42
44
45
46
Caractere
Funo
Cabealho
1, 2, 3 e 39
Mquina
Produtos 1 ao
16
\r e \n
4, 5 e 6
7 ao 38
40 e 41
47
48
49
Captulo 4 Concluso
Com o prottipo desenvolvido, podemos observar que a transmisso de
dados conforme descrito no projeto foi realizada com sucesso, porm algumas
circunstncias devem ser consideradas como, por exemplo, a cobertura do servio
oferecido pelas operadas de telefonia mvel.
Nosso prottipo foi desenvolvido para controlar cinco mquinas
automticas de vendas com at oito produtos por mquina, porm nosso protocolo est
preparado para controlar uma quantidade mxima de 1000 mquinas automticas com
capacidade de 32 produtos por mquina. Para uma possvel comercializao do projeto
dever ser desenvolvido um novo software.
Devemos ressaltar que o projeto dever ser adequado realidade de cada
modelo de mquina de venda, pois cada mquina tem suas caractersticas especficas,
como por exemplo, a quantidade e tipo de produtos vendidos.
Para futuro aprimoramento do projeto, sugerimos o desenvolvimento de
uma interface WEB para os usurios, pois assim eliminaria a necessidade de um software
cliente, uma vez que bastaria apenas um browser para visualizao do sistema.
50
Anexo I
Cdigo fonte do programa Servidor CVA
Cdigo da Form - main.frm
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.ocx"
Begin VB.Form Main
Caption
ClientHeight
ClientLeft
= 120
ClientTop
= 420
ClientWidth
= 11940
LinkTopic
= "Form1"
ScaleHeight
= 3555
ScaleWidth
= 11940
51
= "Sair"
Height
= 375
Left
= 3000
TabIndex
= 10
Top
= 2880
Width
= 1215
End
Begin VB.CommandButton Command1
Caption
Height
= 375
Left
= 600
TabIndex
= 9
Top
= 2880
Width
= 2175
End
Begin VB.PictureBox Picture7
BorderStyle
= 0 'None
Height
Left
= 975
= 480
Picture
= "main.frx":0000
ScaleHeight
= 975
ScaleWidth
= 3735
TabIndex
Top
Width
= 8
= 120
= 3735
End
Begin MSWinsockLib.Winsock wskServidor
Left
= 7560
Top
= 120
_ExtentX
= 741
_ExtentY
= 741
52
_Version
= 393216
End
Begin VB.PictureBox Picture6
BorderStyle
= 0 'None
Height
Left
= 855
= 9240
Picture
= "main.frx":1280
ScaleHeight
= 855
ScaleWidth
= 2415
TabIndex
= 5
Top
= 120
Width
= 2415
End
Begin VB.Label Label11
Caption
= "Gravado:"
Height
= 255
Left
= 7560
TabIndex
= 7
Top
= 2040
Width
= 855
End
Begin VB.Label Label10
Height
Left
= 255
= 8400
TabIndex
= 6
Top
= 2040
Width
= 1335
End
Begin VB.Label txtReceber
BorderStyle
= 1 'Fixed Single
Caption
= "Aguardando Comunicao"
Height
= 375
Left
= 600
53
TabIndex
Top
Width
= 4
= 2040
= 6615
End
Begin VB.Label Label5
Caption
= "--:--"
Height
= 255
Left
TabIndex
Top
Width
= 4200
= 3
= 1680
= 735
End
Begin VB.Label Label4
Caption
= "--/--/----"
Height
= 255
Left
TabIndex
Top
Width
= 2880
= 2
= 1680
= 975
End
Begin VB.Label Label2
Caption
= "as"
Height
= 255
Left
TabIndex
Top
Width
= 3840
= 1
= 1680
= 255
End
Begin VB.Label Label1
Caption
Height
= 255
Left
TabIndex
= 600
= 0
54
Top
Width
= 1680
= 2295
End
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conexao As New ADODB.Connection 'cria a variavel de conexao
Dim tabela As New ADODB.Recordset 'cria a variavel da tabela
Dim sql As String 'cria a string SQL
55
56
57
End If
End Sub
Cdigo Parque.frm
VERSION 5.00
Begin VB.Form parque
Caption
ClientHeight
= 8175
ClientLeft
= 225
ClientTop
= 525
ClientWidth
= 11760
LinkTopic
= "Form1"
ScaleHeight
= 8175
ScaleWidth
= 11760
= 0 'None
Height
Left
= 855
= 11160
Picture
= "parque.frx":0000
ScaleHeight
= 855
ScaleWidth
= 2295
TabIndex
= 5
Top
= 240
Width
= 2295
End
Begin VB.PictureBox Picture2
BorderStyle
Height
Left
= 0 'None
= 975
= 240
Picture
ScaleHeight
= "parque.frx":0F05
= 975
58
ScaleWidth
= 3615
TabIndex
Top
Width
= 4
= 240
= 3615
End
Begin VB.Frame Frame1
Caption
= "Parque de Mquinas"
Height
= 6495
Left
= 120
TabIndex
Top
Width
= 0
= 1560
= 13455
= "Sair"
Height
= 375
Left
= 11640
TabIndex
= 2
Top
= 5880
Width
= 1215
End
Begin VB.PictureBox icmaq
Height
= 1455
Index
= 0
Left
= 360
Picture
= "parque.frx":2185
ScaleHeight
= 1395
ScaleWidth
= 1875
TabIndex
= 1
Tag
= "0"
Top
= 840
Visible
= 0 'False
Width
= 1935
End
59
= "Mquina 01"
Height
= 255
Index
= 0
Left
= 720
TabIndex
= 3
Top
= 2400
Visible
= 0 'False
Width
= 1095
End
End
Begin VB.Label Label1
Caption
= "Parque de Mquinas"
BeginProperty Font
Name
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
TabIndex
Top
Width
= 495
= 5640
= 6
= 600
= 3735
End
End
Attribute VB_Name = "parque"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
60
n = tabela("maq")
lout = 1
teste = 0
lft1 = 400
lft2 = 1000
lft3 = 400
lft4 = 1000
Do Until tabela.EOF = True
If Not teste = tabela("maq") Then
If lout < 7 Then
n = tabela("maq")
Load icmaq(n)
icmaq(n).Visible = True
icmaq(n).Top = 800
icmaq(n).Left = lft1
lft1 = lft1 + 2135
Load txtmaq(n)
txtmaq(n).Visible = True
61
txtmaq(n).Top = 2300
txtmaq(n).Left = lft2
txtmaq(n).Caption = "Mquina " & n
lft2 = lft2 + 2135
teste = tabela("maq")
lout = lout + 1
Else
n = tabela("maq")
Load icmaq(n)
icmaq(n).Visible = True
icmaq(n).Top = 3000
icmaq(n).Left = lft3
lft3 = lft3 + 2135
Load txtmaq(n)
txtmaq(n).Visible = True
txtmaq(n).Top = 4500
txtmaq(n).Left = lft4
txtmaq(n).Caption = "Mquina " & n
lft4 = lft4 + 2135
teste = tabela("maq")
lout = lout + 1
End If
End If
tabela.MoveNext
Loop
End Sub
Private Sub icmaq_Click(Index As Integer)
Unload Maquina
tmaq = Index
tmaq = Format(tmaq, "000")
Maquina.Show
End Sub
62
Cdigo Mquin.frm
VERSION 5.00
Begin VB.Form Maquina
BorderStyle
Caption
= 1 'Fixed Single
= "Maquina 01"
ClientHeight
= 9720
ClientLeft
= 45
ClientTop
= 345
ClientWidth
= 12600
LinkTopic
= "Form1"
MaxButton
= 0 'False
MinButton
= 0 'False
ScaleHeight
= 9720
ScaleWidth
= 12600
= "Produto 9"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 0
Left
TabIndex
Top
Width
= 600
= 70
= 5280
= 2655
63
= &H8000000F&
= 285
= 1560
= -1 'True
= 74
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.TextBox Text26
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 73
= 720
= 975
End
Begin VB.TextBox Text25
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 72
= 1080
= 975
End
Begin VB.CommandButton Command2
Caption
= "Inventrio"
Height
= 255
Left
TabIndex
= 120
= 71
64
Top
Width
= 1440
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 8
Left
TabIndex
Top
Width
= 120
= 77
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 8
Left
TabIndex
Top
Width
= 120
= 76
= 720
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 8
Left
TabIndex
Top
Width
= 120
= 75
= 360
= 1455
End
End
Begin VB.Frame produto5
Caption
= "Produto 5"
65
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 3
Left
= 600
TabIndex
Top
= 37
= 3480
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 66
= 1440
= 975
End
Begin VB.TextBox Text15
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 52
= 1080
= 975
End
Begin VB.TextBox Text14
66
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 51
= 720
= 975
End
Begin VB.TextBox Text13
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 50
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 4
Left
TabIndex
Top
Width
= 120
= 40
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 4
Left
TabIndex
= 120
= 39
67
Top
= 720
Width
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 4
Left
= 120
TabIndex
= 38
Top
= 1080
Width
= 1455
End
End
Begin VB.Timer Timer1
Interval
= 200
Left
= 11280
Top
= 1200
End
Begin VB.PictureBox Picture2
BorderStyle
= 0 'None
Height
Left
= 975
= 0
Picture
= "Mquina.frx":0000
ScaleHeight
= 975
ScaleWidth
= 3615
TabIndex
Top
Width
= 33
= 120
= 3615
End
Begin VB.CommandButton Command1
Caption
= "Fechar"
Height
= 375
Left
= 10680
68
TabIndex
= 32
Top
= 9240
Width
= 1575
End
Begin VB.PictureBox Picture1
BorderStyle
= 0 'None
Height
Left
= 855
= 9960
Picture
= "Mquina.frx":1280
ScaleHeight
= 855
ScaleWidth
= 2295
TabIndex
= 31
Top
= 240
Width
= 2295
End
Begin VB.Frame produto8
Caption
= "Produto 8"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 6
Left
TabIndex
Top
Width
= 9240
= 27
= 3480
= 2655
69
Caption
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 69
= 1440
= 975
End
Begin VB.TextBox Text24
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 61
= 1080
= 975
End
Begin VB.TextBox Text23
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 60
= 720
= 975
End
Begin VB.TextBox Text22
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 59
Text
= "100"
Top
= 360
70
Width
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 7
Left
TabIndex
Top
Width
= 120
= 30
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 7
Left
TabIndex
Top
Width
= 120
= 29
= 720
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 7
Left
TabIndex
Top
Width
= 120
= 28
= 360
= 1455
End
End
Begin VB.Frame produto7
Caption
= "Produto 7"
BeginProperty Font
71
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 5
Left
= 6360
TabIndex
Top
= 23
= 3480
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 68
= 1440
= 975
End
Begin VB.TextBox Text21
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 58
= 1080
= 975
End
Begin VB.TextBox Text20
BackColor
= &H8000000F&
72
Height
Left
Locked
TabIndex
Top
Width
= 285
= 1560
= -1 'True
= 57
= 720
= 975
End
Begin VB.TextBox Text19
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 56
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 6
Left
TabIndex
Top
Width
= 120
= 26
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 6
Left
TabIndex
Top
= 120
= 25
= 720
73
Width
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 6
Left
= 120
TabIndex
= 24
Top
= 360
Width
= 1455
End
End
Begin VB.Frame produto6
Caption
= "Produto 6"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 4
Left
TabIndex
Top
Width
= 3480
= 19
= 3480
= 2655
= "Inventrio"
Height
= 255
Left
= 120
74
TabIndex
Top
Width
= 67
= 1440
= 975
End
Begin VB.TextBox Text18
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 55
= 1080
= 975
End
Begin VB.TextBox Text17
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 54
= 720
= 975
End
Begin VB.TextBox Text16
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 53
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label8
75
Caption
= "Total do Produto:"
Height
= 255
Index
= 5
Left
TabIndex
Top
Width
= 120
= 22
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 5
Left
TabIndex
Top
Width
= 120
= 21
= 720
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 5
Left
TabIndex
Top
Width
= 120
= 20
= 360
= 1455
End
End
Begin VB.Frame produto4
Caption
= "Produto 4"
BeginProperty Font
Name
Size
Charset
76
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 2
Left
= 9240
TabIndex
Top
= 15
= 1680
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 65
= 1440
= 975
End
Begin VB.TextBox Text12
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 49
= 1080
= 975
End
Begin VB.TextBox Text11
BackColor
Height
Left
Locked
= &H8000000F&
= 285
= 1560
= -1 'True
77
TabIndex
Top
Width
= 48
= 720
= 975
End
Begin VB.TextBox Text10
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 47
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 3
Left
TabIndex
Top
Width
= 120
= 18
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 3
Left
TabIndex
Top
Width
= 120
= 17
= 720
= 1335
End
Begin VB.Label Label4
78
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 3
Left
= 120
TabIndex
= 16
Top
= 360
Width
= 1455
End
End
Begin VB.Frame produto3
Caption
= "Produto 3"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 0
Left
TabIndex
Top
Width
= 6360
= 11
= 1680
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 64
= 1440
= 975
79
End
Begin VB.TextBox Text9
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 46
= 1080
= 975
End
Begin VB.TextBox Text8
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 45
= 720
= 975
End
Begin VB.TextBox Text7
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 44
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 2
80
Left
TabIndex
Top
Width
= 120
= 14
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 2
Left
TabIndex
Top
Width
= 120
= 13
= 720
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 2
Left
TabIndex
Top
Width
= 120
= 12
= 360
= 1455
End
End
Begin VB.Frame produto2
Caption
= "Produto 2"
BeginProperty Font
Name
Size
Charset
= 0
Weight
= 700
Underline
Italic
= 0 'False
= 0 'False
81
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 1
Left
= 3480
TabIndex
Top
= 7
= 1680
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 62
= 1440
= 975
End
Begin VB.TextBox Text6
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 43
= 1080
= 975
End
Begin VB.TextBox Text5
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 42
= 720
= 975
82
End
Begin VB.TextBox Text4
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 41
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 1
Left
TabIndex
Top
Width
= 120
= 10
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 1
Left
TabIndex
Top
Width
= 120
= 9
= 720
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 1
83
Left
= 120
TabIndex
= 8
Top
= 1080
Width
= 1455
End
End
Begin VB.Frame Frame1
Caption
= "Produtos"
BeginProperty Font
Name
Size
= 9.75
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 7815
= 360
TabIndex
Top
Width
= 0
= 1320
= 11895
= "Produto 16"
BeginProperty Font
Name
Size
Charset
= 0
Weight
= 700
Underline
Italic
= 0 'False
= 0 'False
Strikethrough = 0 'False
EndProperty
84
Height
Left
= 1815
= 8880
TabIndex
Top
= 107
= 5760
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 149
= 1440
= 975
End
Begin VB.TextBox Text54
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 125
= 1080
= 975
End
Begin VB.TextBox Text53
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 124
= 720
= 975
End
Begin VB.TextBox Text52
BackColor
= &H80000004&
85
Height
Left
Locked
TabIndex
= 285
= 1560
= -1 'True
= 123
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 17
Left
TabIndex
Top
Width
= 120
= 143
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 17
Left
TabIndex
Top
Width
= 120
= 142
= 720
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 17
Left
TabIndex
Top
= 120
= 141
= 1080
86
Width
= 1455
End
End
Begin VB.Frame Frame6
Caption
= "Produto 15"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 1815
= 6000
TabIndex
Top
= 106
= 5760
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 148
= 1440
= 975
End
Begin VB.TextBox Text51
BackColor
Height
Left
Locked
TabIndex
= &H80000004&
= 285
= 1560
= -1 'True
= 122
87
Top
Width
= 1080
= 975
End
Begin VB.TextBox Text50
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 121
= 720
= 975
End
Begin VB.TextBox Text49
BackColor
Height
Left
Locked
TabIndex
= &H80000004&
= 285
= 1560
= -1 'True
= 120
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 16
Left
TabIndex
Top
Width
= 120
= 140
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
88
Height
= 255
Index
= 16
Left
= 120
TabIndex
= 139
Top
= 720
Width
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 16
Left
= 120
TabIndex
= 138
Top
= 1080
Width
= 1455
End
End
Begin VB.Frame Frame5
Caption
= "Produto 14"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
TabIndex
Top
Width
= 1815
= 3120
= 105
= 5760
= 2655
89
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 147
= 1440
= 975
End
Begin VB.TextBox Text48
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 119
= 1080
= 975
End
Begin VB.TextBox Text47
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 118
= 720
= 975
End
Begin VB.TextBox Text46
BackColor
Height
Left
Locked
TabIndex
Text
= &H80000004&
= 285
= 1560
= -1 'True
= 117
= "100"
90
Top
Width
= 360
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 15
Left
TabIndex
Top
Width
= 120
= 137
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 15
Left
TabIndex
Top
Width
= 120
= 136
= 720
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 15
Left
TabIndex
Top
Width
= 120
= 135
= 1080
= 1455
End
End
Begin VB.Frame Frame4
Caption
= "Produto 13"
91
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 1815
= 240
TabIndex
Top
= 104
= 5760
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 146
= 1440
= 975
End
Begin VB.TextBox Text45
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 116
= 1080
= 975
End
Begin VB.TextBox Text44
BackColor
= &H80000004&
92
Height
Left
Locked
TabIndex
Top
Width
= 285
= 1560
= -1 'True
= 115
= 720
= 975
End
Begin VB.TextBox Text43
BackColor
Height
Left
Locked
TabIndex
= &H80000004&
= 285
= 1560
= -1 'True
= 114
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 14
Left
TabIndex
Top
Width
= 120
= 134
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 14
Left
TabIndex
Top
= 120
= 133
= 720
93
Width
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 14
Left
= 120
TabIndex
= 132
Top
= 1080
Width
= 1455
End
End
Begin VB.Frame Frame3
Caption
= "Produto 12"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
TabIndex
Top
Width
= 1815
= 8880
= 103
= 3960
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
= 120
= 145
94
Top
Width
= 1440
= 975
End
Begin VB.TextBox Text42
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 113
= 1080
= 975
End
Begin VB.TextBox Text41
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 112
= 720
= 975
End
Begin VB.TextBox Text40
BackColor
Height
Left
Locked
TabIndex
= &H80000004&
= 285
= 1560
= -1 'True
= 111
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
95
Height
= 375
Index
= 13
Left
TabIndex
Top
Width
= 120
= 131
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 13
Left
TabIndex
Top
Width
= 120
= 130
= 720
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 13
Left
TabIndex
Top
Width
= 120
= 129
= 1080
= 1455
End
End
Begin VB.Frame Frame2
Caption
= "Produto 11"
BeginProperty Font
Name
Size
Charset
= 0
Weight
= 700
96
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 1815
= 6000
TabIndex
Top
= 102
= 3960
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 144
= 1440
= 975
End
Begin VB.TextBox Text39
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H80000004&
= 285
= 1560
= -1 'True
= 110
= 1080
= 975
End
Begin VB.TextBox Text38
BackColor
Height
Left
Locked
TabIndex
Top
= &H80000004&
= 285
= 1560
= -1 'True
= 109
= 720
97
Width
= 975
End
Begin VB.TextBox Text37
BackColor
= &H80000004&
ForeColor
= &H80000007&
Height
Left
Locked
TabIndex
= 285
= 1560
= -1 'True
= 108
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 12
Left
TabIndex
Top
Width
= 120
= 128
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 12
Left
TabIndex
Top
Width
= 120
= 127
= 720
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
98
Height
= 255
Index
= 12
Left
= 120
TabIndex
= 126
Top
= 1080
Width
= 1455
End
End
Begin VB.Frame produto5
Caption
= "Produto 5"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 1
Left
= 3120
TabIndex
Top
Width
= 78
= 3960
= 2655
= "Produto 5"
BeginProperty Font
Name
Size
Charset
= 0
Weight
= 700
Underline
= 0 'False
99
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 2
Left
= 0
TabIndex
Top
Width
= 86
= 0
= 2655
= "Produto 10"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 4
Left
TabIndex
Top
Width
= 0
= 94
= 0
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 98
= 1440
= 975
100
End
Begin VB.TextBox Text36
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 97
= 1080
= 975
End
Begin VB.TextBox Text35
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 96
= 720
= 975
End
Begin VB.TextBox Text34
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 95
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 11
101
Left
TabIndex
Top
Width
= 120
= 101
= 360
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 11
Left
TabIndex
Top
Width
= 120
= 100
= 720
= 1335
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 11
Left
TabIndex
Top
Width
= 120
= 99
= 1080
= 1455
End
End
Begin VB.TextBox Text33
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 90
Text
= "100"
Top
= 360
Width
= 975
102
End
Begin VB.TextBox Text32
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 89
= 720
= 975
End
Begin VB.TextBox Text31
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 88
= 1080
= 975
End
Begin VB.CommandButton Command12
Caption
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 87
= 1440
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 10
Left
TabIndex
= 120
= 93
103
Top
Width
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 10
Left
TabIndex
Top
Width
= 120
= 92
= 720
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 10
Left
TabIndex
Top
Width
= 120
= 91
= 360
= 1455
End
End
Begin VB.TextBox Text30
BackColor
Height
Left
Locked
TabIndex
= &H8000000F&
= 285
= 1560
= -1 'True
= 82
Text
= "100"
Top
= 360
Width
= 975
End
Begin VB.TextBox Text29
104
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 81
= 720
= 975
End
Begin VB.TextBox Text28
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 80
= 1080
= 975
End
Begin VB.CommandButton Command11
Caption
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 79
= 1440
= 975
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 9
Left
TabIndex
Top
Width
= 120
= 85
= 1080
= 1455
105
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 9
Left
= 120
TabIndex
= 84
Top
= 720
Width
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 9
Left
= 120
TabIndex
= 83
Top
= 360
Width
= 1455
End
End
Begin VB.Frame Produto1
Caption
= "Produto 1"
BeginProperty Font
Name
Size
= 8.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 1815
Index
= 0
106
Left
= 240
TabIndex
Top
= 3
= 360
Width
= 2655
= "Inventrio"
Height
= 255
Left
TabIndex
Top
Width
= 120
= 63
= 1440
= 975
End
Begin VB.TextBox Text3
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 36
= 1080
= 855
End
Begin VB.TextBox Text2
BackColor
Height
Left
Locked
TabIndex
Top
Width
= &H8000000F&
= 285
= 1560
= -1 'True
= 35
= 720
= 855
End
Begin VB.TextBox Text1
BackColor
Height
= &H8000000F&
= 285
107
Left
Locked
TabIndex
= 1560
= -1 'True
= 34
Text
= "100"
Top
= 360
Width
= 855
End
Begin VB.Label Label8
Caption
= "Total do Produto:"
Height
= 255
Index
= 0
Left
TabIndex
Top
Width
= 120
= 6
= 1080
= 1455
End
Begin VB.Label Label6
Caption
= "tens Vendidos:"
Height
= 255
Index
= 0
Left
TabIndex
Top
Width
= 120
= 5
= 720
= 1335
End
Begin VB.Label Label4
Caption
= "Quantidade inicial:"
Height
= 375
Index
= 0
Left
TabIndex
Top
Width
= 120
= 4
= 360
= 1455
108
End
End
End
Begin VB.Label Label2
Caption
= "01"
BeginProperty Font
Name
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 375
= 6840
TabIndex
= 2
Top
= 600
Width
= 855
End
Begin VB.Label Label1
Caption
= "Mquina:"
BeginProperty Font
Name
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
Italic
= 0 'False
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 375
= 5400
109
TabIndex
Top
= 1
= 600
Width
= 1335
End
End
Attribute VB_Name = "Maquina"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conexao As New ADODB.Connection 'cria a variavel de conexao
Dim tabela As New ADODB.Recordset 'cria a variavel da tabela
Dim sql As String 'cria a string SQL
110
Invent.Show
End Sub
111
112
Invent.Show
End Sub
SQL, E A CONEXAO
If tabela.EOF = True Then
Text2.Text = "Banco Vazio"
Text5.Text = "Banco Vazio"
113
114
Text38.Text = tabela("p11")
Text39.Text = Text37.Text - Text38.Text
Text41.Text = tabela("p12")
Text42.Text = Text40.Text - Text41.Text
Text44.Text = tabela("p13")
Text45.Text = Text43.Text - Text44.Text
Text47.Text = tabela("p14")
Text48.Text = Text46.Text - Text47.Text
Text50.Text = tabela("p15")
Text51.Text = Text49.Text - Text50.Text
Text53.Text = tabela("p16")
Text54.Text = Text52.Text - Text53.Text
End If
tabela.MoveNext
Loop
End If
tabela.Close
conexao.Close
End Sub
Cdigo Invent.frm
VERSION 5.00
Begin VB.Form Invent
Caption
ClientHeight
= "Inventrio"
= 3990
ClientLeft
= 120
ClientTop
= 420
ClientWidth
= 12135
LinkTopic
= "Form1"
ScaleHeight
= 3990
ScaleWidth
= 12135
115
= &H80000004&
BorderStyle
= 0 'None
BeginProperty Font
Name
Size
= 12
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 420
= 7800
Locked
= -1 'True
TabIndex
= 13
Text
= "--:--:--"
Top
= 2400
Width
= 1095
End
Begin VB.TextBox Text3
BackColor
= &H80000004&
BorderStyle
= 0 'None
BeginProperty Font
Name
Size
Charset
= 0
Weight
= 700
Underline
Italic
= 0 'False
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 375
116
Left
Locked
TabIndex
= 6000
= -1 'True
= 12
Text
= "--/--/---"
Top
= 2400
Width
= 1455
End
Begin VB.CommandButton Command1
Caption
= "Fechar"
Height
= 375
Left
TabIndex
Top
Width
= 10080
= 11
= 3360
= 1575
End
Begin VB.TextBox Text2
BackColor
Height
Left
Locked
TabIndex
= &H80000004&
= 285
= 4560
= -1 'True
= 10
Text
= "Sem Registro"
Top
= 2880
Width
= 1215
End
Begin VB.TextBox Text1
BackColor
Height
Left
Locked
TabIndex
= &H80000004&
= 285
= 9120
= -1 'True
= 8
Text
= "Sem Registro"
Top
= 2400
117
Width
= 1215
End
Begin VB.PictureBox Picture1
BorderStyle
= 0 'None
Height
Left
= 855
= 9600
Picture
= "Invent.frx":0000
ScaleHeight
= 855
ScaleWidth
= 2295
TabIndex
= 1
Top
= 120
Width
= 2295
End
Begin VB.PictureBox Picture2
BorderStyle
= 0 'None
Height
Left
= 975
= 240
Picture
= "Invent.frx":0F05
ScaleHeight
= 975
ScaleWidth
= 3615
TabIndex
Top
Width
= 0
= 120
= 3615
End
Begin VB.Label Label5
Caption
BeginProperty Font
Name
Size
Charset
= 0
Weight
= 700
Underline
Italic
= 0 'False
= 0 'False
118
Strikethrough = 0 'False
EndProperty
Height
= 375
Index
= 1
Left
= 120
TabIndex
= 9
Top
= 2880
Width
= 4335
End
Begin VB.Label Label6
Caption
= "as"
BeginProperty Font
Name
Size
= 12
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 375
Index
= 1
Left
TabIndex
Top
Width
= 7440
= 7
= 2400
= 375
End
Begin VB.Label Label5
Caption
BeginProperty Font
Name
Size
Charset
119
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
= 375
Index
= 0
Left
= 120
TabIndex
= 6
Top
= 2400
Width
= 5895
End
Begin VB.Label Label4
Caption
= "Produto:"
BeginProperty Font
Name
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
TabIndex
Top
Width
= 375
= 120
= 5
= 1680
= 1335
End
Begin VB.Label Label3
Caption
= "01"
BeginProperty Font
Name
120
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
= 375
= 1560
TabIndex
= 4
Top
= 1680
Width
= 855
End
Begin VB.Label Label1
Caption
= "Mquina:"
BeginProperty Font
Name
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
TabIndex
Top
Width
= 375
= 120
= 3
= 1320
= 1335
End
Begin VB.Label Label2
Caption
= "01"
BeginProperty Font
121
Name
Size
= 14.25
Charset
= 0
Weight
= 700
Underline
= 0 'False
Italic
= 0 'False
Strikethrough = 0 'False
EndProperty
Height
Left
TabIndex
Top
Width
= 375
= 1560
= 2
= 1320
= 855
End
End
Attribute VB_Name = "Invent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conexao As New ADODB.Connection 'cria a variavel de conexao
Dim tabela As New ADODB.Recordset 'cria a variavel da tabela
Dim sql As String 'cria a string SQL
122
SQL, E A CONEXAO
x=0
Do Until tabela.EOF = True
If tprod = 1 Then
If tabela("r01") <> "-" Then
x = x + tabela("p01")
Text1.Text = x
Text2.Text = tabela("r01")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 2 Then
If tabela("r02") <> "-" Then
x = x + tabela("p02")
Text1.Text = x
Text2.Text = tabela("r02")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 3 Then
If tabela("r03") <> "-" Then
123
x = x + tabela("p03")
Text1.Text = x
Text2.Text = tabela("r03")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 4 Then
If tabela("r04") <> "-" Then
x = x + tabela("p04")
Text1.Text = x
Text2.Text = tabela("r04")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 5 Then
If tabela("r05") <> "-" Then
x = x + tabela("p05")
Text1.Text = x
Text2.Text = tabela("r05")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 6 Then
If tabela("r06") <> "-" Then
x = x + tabela("p06")
Text1.Text = x
Text2.Text = tabela("r06")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
124
End If
If tprod = 7 Then
If tabela("r07") <> "-" Then
x = x + tabela("p07")
Text1.Text = x
Text2.Text = tabela("r07")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 8 Then
If tabela("r08") <> "-" Then
x = x + tabela("p08")
Text1.Text = x
Text2.Text = tabela("r08")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 9 Then
If tabela("r09") <> "-" Then
x = x + tabela("p09")
Text1.Text = x
Text2.Text = tabela("r09")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 10 Then
If tabela("r10") <> "-" Then
x = x + tabela("p10")
Text1.Text = x
Text2.Text = tabela("r10")
125
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 11 Then
If tabela("r11") <> "-" Then
x = x + tabela("p11")
Text1.Text = x
Text2.Text = tabela("r11")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 12 Then
If tabela("r12") <> "-" Then
x = x + tabela("p12")
Text1.Text = x
Text2.Text = tabela("r12")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 13 Then
If tabela("r13") <> "-" Then
x = x + tabela("p13")
Text1.Text = x
Text2.Text = tabela("r13")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 14 Then
If tabela("r14") <> "-" Then
126
x = x + tabela("p14")
Text1.Text = x
Text2.Text = tabela("r14")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 15 Then
If tabela("r15") <> "-" Then
x = x + tabela("p15")
Text1.Text = x
Text2.Text = tabela("r15")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
If tprod = 16 Then
If tabela("r16") <> "-" Then
x = x + tabela("p16")
Text1.Text = x
Text2.Text = tabela("r16")
Text3.Text = tabela("data")
Text4.Text = tabela("hora")
End If
End If
tabela.MoveNext
Loop
tabela.Close
conexao.Close
End Sub
127
Anexo II
Programao PIC - GPRS
#include <16F876A.h>
#include <string.h>
#use delay(clock=20000000)
#use rs232(baud=115200,xmit=pin_c6, rcv=pin_c7)
#fuses hs,nolvp,nowdt,noput
#byte TXREG = 0x19
#byte RXREG = 0x1A
#bit TRMT
= 0x98.1
int mux1,mux2,mux3,mux4;
int p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16;
int r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16;
int maq=001,seg=0;
int z=0,inc=0;
conectar()
{
puts("AT+CSTT=\"TIM.BR\",\"TIM\",\"TIM\" ");
delay_ms(2000);
puts("AT+CDNSCFG=\"208.67.222.222\" ");
delay_ms(2000);
puts("AT+CDNSGIP=\"univercidade.edu\"");
delay_ms(6000);
128
puts("AT+CIFSR");
delay_ms(4000);
puts("AT+CIPSTART=\"TCP\",\"189.66.242.123\",\"100\" ");
delay_ms(5000);
}
enviar()
{
output_high(pin_c2);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("cva%03u%02u%02u%02u%02u%02u%02u%02u%02u%02u%02u%02u%02u%02
u%02u%02u%02u\r\n",maq,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16);
envia_byte(10);
envia_byte(26);
output_low(pin_c2);
}
zerar()
{
if (p1==255)
{
p1=0;
write_eeprom (1, p1);
}
if (p2==255)
{
p2=0;
write_eeprom (3, p2);
}
if (p3==255)
{
129
p3=0;
write_eeprom (5, p3);
}
if (p4==255)
{
p4=0;
write_eeprom (7, p4);
}
if (p5==255)
{
p5=0;
write_eeprom (9, p5);
}
if (p6==255)
{
p6=0;
write_eeprom (11, p6);
}
if (p7==255)
{
p7=0;
write_eeprom (13, p7);
}
if (p8==255)
{
p8=0;
write_eeprom (15, p8);
}
if (p9==255)
{
p9=0;
write_eeprom (17, p9);
}
130
if (p10==255)
{
p10=0;
write_eeprom (19, p10);
}
if (p11==255)
{
p11=0;
write_eeprom (21, p11);
}
if (p12==255)
{
p12=0;
write_eeprom (23, p12);
}
if (p13==255)
{
p13=0;
write_eeprom (25, p13);
}
if (p14==255)
{
p14=0;
write_eeprom (27, p14);
}
if (p15==255)
{
p15=0;
write_eeprom (29, p15);
}
if (p16==255)
{
p16=0;
131
ende_mux(int x)
{
output_b(x);
delay_ms(20);
z++;
if (z==50)
{
z=0;
seg++;
if (seg==60)
{
zerar();
enviar();
seg=0;
}
}
}
tmux1(int p)
{
if (p==0)
{
if (p1==255) p1=1; else
p1 = read_eeprom(1) + 1;
write_eeprom (1, p1);
output_high(pin_c0);
}
if (p==1)
{
132
133
if (p==4)
{
if (p3==255) p3=1; else
p3 = read_eeprom(5) + 1;
write_eeprom (5, p3);
output_high(pin_c0);
}
if (p==5)
{
if (r3==255) r3=1; else
r3 = read_eeprom(6) + 1;
write_eeprom (6, r3);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up03r03%02u%02u,\r\n",maq,p3,r3);
envia_byte(10);
envia_byte(26);
p3=0;
write_eeprom (5, p3);
}
if (p==6)
{
if (p4==255) p4=1; else
p4 = read_eeprom(7) + 1;
write_eeprom (7, p4);
output_high(pin_c0);
}
if (p==7)
{
if (r4==255) r4=1; else
r4 = read_eeprom(8) + 1;
write_eeprom (8, r4);
134
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up04r04%02u%02u,\r\n",maq,p4,r4);
envia_byte(10);
envia_byte(26);
p4=0;
write_eeprom (7, p4);
}
}
tmux2(int p)
{
if (p==0)
{
if (p5==255) p5=1; else
p5 = read_eeprom(9) + 1;
write_eeprom (9, p5);
output_high(pin_c0);
}
if (p==1)
{
if (r5==255) r5=1; else
r5 = read_eeprom(10) + 1;
write_eeprom (10, r5);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up05r05%02u%02u,\r\n",maq,p5,r5);
envia_byte(10);
envia_byte(26);
p5=0;
write_eeprom (9, p5);
}
135
if (p==2)
{
if (p6==255) p6=1; else
p6 = read_eeprom(11) + 1;
write_eeprom (11, p6);
output_high(pin_c0);
}
if (p==3)
{
if (r6==255) r6=1; else
r6 = read_eeprom(12) + 1;
write_eeprom (12, r6);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up06r06%02u%02u,\r\n",maq,p6,r6);
envia_byte(10);
envia_byte(26);
p6=0;
write_eeprom (11, p6);
}
if (p==4)
{
if (p7==255) p7=1; else
p7 = read_eeprom(13) + 1;
write_eeprom (13, p7);
output_high(pin_c0);
}
if (p==5)
{
if (r7==255) r7=1; else
r7 = read_eeprom(14) + 1;
write_eeprom (14, r7);
136
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up07r07%02u%02u,\r\n",maq,p7,r7);
envia_byte(10);
envia_byte(26);
p7=0;
write_eeprom (13, p7);
}
if (p==6)
{
if (p8==255) p8=1; else
p8 = read_eeprom(15) + 1;
write_eeprom (15, p8);
output_high(pin_c0);
}
if (p==7)
{
if (r8==255) r8=1; else
r8 = read_eeprom(16) + 1;
write_eeprom (16, r8);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up08r08%02u%02u,\r\n",maq,p8,r8);
envia_byte(10);
envia_byte(26);
p8=0;
write_eeprom (15, p8);
}
}
tmux3(int p)
{
137
if (p==0)
{
if (p9==255) p9=1; else
p9 = read_eeprom(17) + 1;
write_eeprom (17, p9);
output_high(pin_c0);
}
if (p==1)
{
if (r9==255) r9=1; else
r9 = read_eeprom(18) + 1;
write_eeprom (18, r9);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up09r09%02u%02u,\r\n",maq,p9,r9);
envia_byte(10);
envia_byte(26);
p9=0;
write_eeprom (17, p9);
}
if (p==2)
{
if (p10==255) p10=1; else
p10 = read_eeprom(19) + 1;
write_eeprom (19, p10);
output_high(pin_c0);
}
if (p==3)
{
if (r10==255) r10=1; else
r10 = read_eeprom(20) + 1;
write_eeprom (20, r10);
138
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up10r10%02u%02u,\r\n",maq,p10,r10);
envia_byte(10);
envia_byte(26);
p10=0;
write_eeprom (19, p10);
}
if (p==4)
{
if (p11==255) p11=1; else
p11 = read_eeprom(21) + 1;
write_eeprom (21, p11);
output_high(pin_c0);
}
if (p==5)
{
if (r11==255) r11=1; else
r11 = read_eeprom(22) + 1;
write_eeprom (22, r11);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up11r11%02u%02u,\r\n",maq,p11,r11);
envia_byte(10);
envia_byte(26);
p11=0;
write_eeprom (21, p11);
}
if (p==6)
{
if (p12==255) p12=1; else
139
p12 = read_eeprom(23) + 1;
write_eeprom (23, p12);
output_high(pin_c0);
}
if (p==7)
{
if (r12==255) r12=1; else
r12 = read_eeprom(24) + 1;
write_eeprom (24, r12);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up12r12%02u%02u,\r\n",maq,p12,r12);
envia_byte(10);
envia_byte(26);
p12=0;
write_eeprom (23, p12);
}
}
tmux4(int p)
{
if (p==0)
{
if (p13==255) p13=1; else
p13 = read_eeprom(25) + 1;
write_eeprom (25, p13);
output_high(pin_c0);
}
if (p==1)
{
if (r13==255) r13=1; else
r13 = read_eeprom(26) + 1;
write_eeprom (26, r13);
140
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up13r13%02u%02u,\r\n",maq,p13,r13);
envia_byte(10);
envia_byte(26);
p13=0;
write_eeprom (25, p13);
}
if (p==2)
{
if (p14==255) p14=1; else
p14 = read_eeprom(27) + 1;
write_eeprom (27, p14);
output_high(pin_c0);
}
if (p==3)
{
if (r14==255) r14=1; else
r14 = read_eeprom(28) + 1;
write_eeprom (28, r14);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up14r14%02u%02u,\r\n",maq,p14,r14);
envia_byte(10);
envia_byte(26);
p14=0;
write_eeprom (27, p14);
}
if (p==4)
{
if (p15==255) p15=1; else
141
p15 = read_eeprom(29) + 1;
write_eeprom (29, p15);
output_high(pin_c0);
}
if (p==5)
{
if (r15==255) r15=1; else
r15 = read_eeprom(30) + 1;
write_eeprom (30, r15);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
printf("rec%03up15r15%02u%02u,\r\n",maq,p15,r15);
envia_byte(10);
envia_byte(26);
p15=0;
write_eeprom (29, p15);
}
if (p==6)
{
if (p16==255) p16=1; else
p16 = read_eeprom(31) + 1;
write_eeprom (31, p16);
output_high(pin_c0);
}
if (p==7)
{
if (r16==255) r16=1; else
r16 = read_eeprom(32) + 1;
write_eeprom (32, r16);
conectar();
puts("AT+CIPSEND");
delay_ms(1000);
142
printf("rec%03up16r16%02u%02u,\r\n",maq,p16,r16);
envia_byte(10);
envia_byte(26);
p16=0;
write_eeprom (31, p16);
}
}
void main()
{
p1=read_eeprom(1);
r1=read_eeprom(2);
p2=read_eeprom(3);
r2=read_eeprom(4);
p3=read_eeprom(5);
r3=read_eeprom(6);
p4=read_eeprom(7);
r4=read_eeprom(8);
p5=read_eeprom(9);
r5=read_eeprom(10);
p6=read_eeprom(11);
r6=read_eeprom(12);
p7=read_eeprom(13);
r7=read_eeprom(14);
p8=read_eeprom(15);
r8=read_eeprom(16);
p9=read_eeprom(17);
r9=read_eeprom(18);
p10=read_eeprom(19);
r10=read_eeprom(20);
p11=read_eeprom(21);
r11=read_eeprom(22);
p12=read_eeprom(23);
143
r12=read_eeprom(24);
p13=read_eeprom(25);
r13=read_eeprom(26);
p14=read_eeprom(27);
r14=read_eeprom(28);
p15=read_eeprom(29);
r15=read_eeprom(30);
p16=read_eeprom(31);
r16=read_eeprom(32);
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
delay_ms(15000);
while (true)
{
int y=0;
output_b(0);
while (y<8)
{
ende_mux(y);
mux1=input(pin_b3);
mux2=input(pin_b4);
mux3=input(pin_b5);
mux4=input(pin_b7);
if (mux1==1) tmux1(y);
if (mux2==1) tmux2(y);
if (mux3==1) tmux3(y);
if (mux4==1) tmux4(y);
output_low(pin_c0);
y++;
}
144
}
}
#int_rda
void isr_serial(void)
{
char teste;
teste = getchar();
}
145
Referncias Bibliogrficas
[1] Fernandes, Osmar., Telemetria e Sensoriamento Remoto. III Edio, Copel, 1992.
[4] Pereira, Fbio., Microcontroladores Pic Tcnicas Avanadas. V Edio, rica, 2002.
Engenharia
FENGPUC,
Rio
Grande
do
Sul.
Disponvel
em:
[7] Sckimger, Rob., et. al, TCP/IP a Bblia. I Edio, Elsevier, 2008.
[10] Kurose, James, et. Al., Redes de Computadores e a Internet. III Edio, Pearson,
2007.
[11] Krishnamurthy, Balachander, et. al., Redes para Web. I Edio, Campus, 2001.
[12] Carvalho, Alan (2006) O Que GPRS, In: Wirelles Br, Joo Pessoa. Disponvel em:
http://www.wirelessbrasil.org/wirelessbr/colaboradores/alancarvalho/gprs.html.
Acesso
146
[13] Humberto, Jos., Redes GSM, GPRS, EDGE e UMTS. I Edio, Editora rica, 2005.
2005
147