Welcome to the Zilog forum!
Go to bottomPage: 123
TOPIC:
#625
Re:Led Matrix Board via SMS using Zilog encore 2 Years, 3 Months ago Karma: 0
Good day Sir!

Have you been able to check the code I attached yesterday?

I attached the picture of the led matrix that we are gong to use and the sim900d GSM Modem. Three 8x32 led matrix will be cascaded...
Actually sir, there's no more problem with the hardware. The only problem is the code.

It must be able to display/handle 3(only) messages sent via sms (160 characters each). New message/s after these 3 messages must overwrite the first message/s.

Thanks for the suggestion sir. we'll try it..
anemokid (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#626
Re:Led Matrix Board via SMS using Zilog encore 2 Years, 3 Months ago Karma: 0
Good day Sir!

Have you been able to check the code I attached yesterday?

I attached the picture of the led matrix that we are gong to use and the sim900d GSM Modem. Three 8x32 led matrix will be cascaded...
Actually sir, there's no more problem with the hardware. The only problem is the code.

It must be able to display/handle 3(only) messages sent via sms (160 characters each). New message/s after these 3 messages must overwrite the first message/s.

Thanks for the suggestion sir. we'll try it..
anemokid (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#627
Re:Led Matrix Board via SMS using Zilog encore 2 Years, 3 Months ago Karma: 0
Good day Sir!

Have you been able to check the code I attached yesterday?

I attached the picture of the led matrix that we are gong to use and the sim900d GSM Modem. Three 8x32 led matrix will be cascaded...
Actually sir, there's no more problem with the hardware. The only problem is the code.

It must be able to display/handle 3(only) messages sent via sms (160 characters each). New message/s after these 3 messages must overwrite the first message/s.

Thanks for the suggestion sir. we'll try it..
anemokid (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#628
Re:Led Matrix Board via SMS using Zilog encore 2 Years, 3 Months ago Karma: 0
Im sorry sir, I have posted my reply several times. I was trying to attached our code and the images of our hardware but think it is not allowed here.

Here is our code. Can you please check it sir?

MAIN.C
#include <ez8.h>
#include "functions.h"
#include "myuart.h"
#include "GSM.h"
unsigned char counter;
unsigned char COMM;
unsigned char *pointer;
unsigned char overflow;
unsigned char count;
unsigned char status;
unsigned char *rampointer;
unsigned char *charpointer;
unsigned char temp;
unsigned char *pointer2;
unsigned char counter2;
unsigned char counter3;
unsigned char repstat;
unsigned char ramdata[134]; //128+6
unsigned char *rxptr;
near unsigned char rxlen; //length of SIO received string
unsigned char Welcome[100]= ECE \n
unsigned char Rx[250];
unsigned char spaces[25] = " ";
unsigned char rxtmr;
near unsigned char flashtmr;
near unsigned offcnt;
near char code1, code2, code3, code4;
near unsigned char reset;
char Sender[10];
#define CLK 0x04;
#define STR 0x01;
#define DAT 0x02;
#define loadT1 0x0c;
#define wait 0x40;
#define datalim 0xde;
void main()
{
DI(); //disable interrupts
init_gpio(); //initialize ports
init_timer0(); //delay routines
init_uart0(); //serial communication routines
EI(); //enable interrupt
code1 = 's';
code2 = 's';
code3 = 's';
code4 = 's';
Init_GSM();
for(counter = 128; counter > 0; counter-){
clock(); //clear
display
strobe();
}
charpointer = Welcome;
counter2 = 6;
ret:
counter = 16; //number of block
pointer = ramdata + 7;
PBOUT |= DAT;
next8:
counter3 = 8; //8 columns per block
while(counter3 >0){
clock();
strobe();
PBCUT &= ~DAT;
temp = *pointer;
PCOUT = ~temp;
PCDD = ~temp;
for(temp = 50; temp > 0; temp--){}
PCOUT = 0xFF;
PCDD = 0xFF;
pointer--;
counter3--;
}
pointer += 16;
counter--;
if(counter > 0)
goto next8;
pointer = ramdata;
pointer2 = ramdata+1;
counter = 133; //133 times
while(counter > 0){
temp = *pointer2;
*pointer = temp;
pointer++;
pointer2++;
counter--;
}
status &= ~0x80;
counter2--;
if(counter2 > 0)goto ret;
Char2Ram(); //get next character
counter2 = 6;
goto ret;
}
FUNCTION.C
#include <eZ8.h>
#include "cmap.h"
#include "myuart.h"
/////////////////////////////////////
// Initializa ports. Add other ports initialization as may be
// necessary
void init_gpio(void)
{
PADD = ~0x40; //ouput
PCDD = 0x00; //PC all output
PBDD &= ~0x07;
PCOUT = 0xff;
PCDD = 0xFF;
}
extern unsigned char status;
extern near unsigned char txtmr;
extern unsigned char *charpointer;
extern near char code1, code2, code3, code4;
near unsigned int alarmctr;
extern char Sender[10];
/////////////////////////////////////
//interrupt routine
// ocurs every 10mS and updates decrements to 0 corresponding
// timers
#pragma interrupt
void isr_timer0(void)
{
if(rxtmr>0) rxtmr--;
if(alarmctr>0) alarmctr--;
else
PDOUT = 0xFF;
}
////////////////////////////////////
// Initialize Timer-0
void init_timer0(void)
{
SET_VECTOR(TIMER, isr_timer0);
T0H = 0x00; //Timer High
T0L = 0x01; //Timer Low
T0RH = 0x14; // Reload Compare High
T0RL = 0x00; // Reload Compare Low
T0CTL = 0xE9; // Continous/Prescale div 32
IRQ0ENH |= 0x20; // Set Interrupt Priority Nominal
IRQ0ENL &= 0xDF; //Set Interrupt Priority Nominal
}
void clock(void)
{
PBOUT |= 0x04; //clock low
PBOUT &= ~0x04; // clock hi
}
void strobe(void)
{
PBOUT |= 0x01; //strobe low
PBOUT &= ~0x01; //strobe hi
}
near unsigned char i;
near unsigned char msgloc = 1;
near unsigned char replynum;
extern near unsigned char rxlen; // length of SIO received string
extern unsigned char Rx[250];
void Delmsg1(void)
{
Del1:
Tx_String("AT+CMGD=1\n"); //delete message entry #1
WaitRX();
Tx_String("AT+CMGR=1\n"); //read message entry #1
WaitRX();
if(rxlen > 0x30){goto Del1;} //go back if message still exists
}
void DelMsg2(void)
{
Del2:
Tx_String("AT+CMGD=2\n"); //delete message entry #2
WaitRX();
Tx_String("AT+CMGR=2\n"); //read message entry #2
WaitRX();
if(rxlen > 0x30)(goto Del2) //go back if message still exists
}
void DelMsg3(void)
{
Del3:
Tx_String("AT+CMGD=3\n"); //delete message entry #3
WaitRX();
Tx_String("AT+CMGR=3\n"); //read message entry #3
WaitRX();
if(rxlen > 0x30){goto Del3;) //go back if message still exists
}
void Reply(void)
{
Tx_String("AT+CMGS=\"+63");
for(i=0;i<10;i++){
send(Sender[i];}
Tx_String("\"n");
WaitRX();
Tx_String("Message sent is being dislayed!");
send(26);
rxtmr = 400; //delay
while(rxtmr >0);
}
void phone(void)
{
Test:
Tx_String("AT+CMGF=1\n"); //set to text mode
WaitRX();
if(rxlen !=0x10){goto Test;}
MsgRead:
if(msgloc == 1)
{ msgloc = 2;
Tx_String("AT+CMGR=1\n"); //read message entry #1
WaitRX();
if(rxlen < 0x30)
goto Test; //go back if no message
goto process;
}
if(msgloc == 2)
{ msgloc = 3;
Tx_String("AT+CMGR=2\n"); //read message entry #2
WaitRX();
if(rxlen < 0x30)
goto Test; //go back if no message
go to process;
}
if(msgloc == 3)
{ msgloc = 1;
Tx_String("AT+CMGR=3\n"); //read message entry #3
WaitRX();
if(rxlen < 0x30)
goto Test; //go back if no messaage
goto process;
}
process:
if(Rx[0x22] == '9'){ //read
for (i=0;i<10;i++){ //extract sender number
Sender[i]=Rx[i+0x22];}
status = 0;
}
else{
for(i=0;i<10;i++){ //unread
Sender[i]=Rx[i+0x24];} //extract sender number
status = 1; //reply enable

}
for(i=65; Rx[i] != 0x0A; i++){} //look for the first message
if(Rx[i+1] !=code1){goto DelMsg;}
if(Rx[i+2] !=code2){goto DelMsg;}
if(Rx[i+3] !=code3){goto DelMsg;}
if(Rx[i+4] !=code4){goto DelMsg;}
if(Rx[i+5] ==''){
if(status & 0x01){
if(msgloc == 1){ //Current message is message 3
if(replynum == 2 || replynum ==0){
reoplynum = 3;
DelMsg1(),
Reply();
msgloc = 3;
goto Test;
}
}
if(msgloc ==2){ //Current message is message 1
if(replynum == 3|| replynum == 0){
replynum = 1;
DelMsg2();
Reply();
msgloc = 1;
goto Test;
}
}
if(msgloc ==3){ //Current message is message 2
if(replynum == 1 || replynum == 0){
replynum = 2;
DelMsg3();
Reply();
msgloc = 2;
goto Test;
}
}
}
charpointer = &Rx[i+6];
return;
}
DelMsg:
if(msgloc == 1)
{
DelMsg3();
goto Test;
}
if(msgloc ==2)
{
Delmsg1();
goto Test;
}
if(msgloc == 3)
{
DelMsg2();
goto Test;
}
}
extern unsigned char couter;
extern unsigned char ramdata[81];
extern unsigned char spaces[15];
extern unsigned char *rampointer;
void Char2Ram(void)
{
rampointer = ramdata+128;
counter = 0;
while(counter < 6){
*rampointer = character_data[*charpointer-0x20][counter];
counter++;
rampointer++;
}
charpointer++;
if(charpointer == &spaces+22){
//// charpointer = Rx;
phone();
return;
}
if(*charpointer == 0x0D || *charpointer == 0x0A)
charpointer = spaces;
}
GSM.C
#include <eZ8.h>
#include "myuart.h"
extern near unsigned char reset;
extern near unsigned char rxlen;
extern near unsigned char rxtmr;
extern unsigned char Rx[250];
///////////////////////////////////
//Initializa GSM Module until it is ready
void Init_GSM(void)
{
ON:
//switch ON GSM Module
PAOUT |=0x40; //PA6 =0 for 1sec to turn ON module
rxtmr = 100;
while(rxtmr >0);
PAOUT &= ~0x40;
rxtmr = 10;
while(rxtmr > 0);
reset = 0;
testcon:
reset++;
if(reset == 10){goto ON;}
Tx_String("AT\n"); //Test Connection
WaitRX();
if(rxlen != 9){goto tescon;}
Tx_String("AT+CFUN=1\n");
WaitRX();
if(rxlen !=0x10){goto testcon;}
reset = 0;
connect;
Tx_String("AT+COPS=0\n");
WaitRX2();
if(Rx[rxlen-3] !='K'){goto connect;} //equal to if OK
}
MYUART.C
#include <sio.h>
extern unsigned char *rxptr;
extern near unsigned char rxlen; //length of SIO received string
extern unsigned char Rx[250];
extern near unsigned char rxtmr;
#pragma interrupt
void isr_uart0_rx(void)
{
unsigned char rxin;
rxin = U0RXD; //read SIO
if(rxlen >=250) return; //buffer overflow, no further rx
*rxptr = rxin; //store in buffer
rxptr++; //point to next
rxlen++;
}
/////////////////////////////////
//Initialize UART-0
void init_uart0(void)
{
init_uart(_UART0,_DEFFREQ,38400); //Setup Uart0
SET_VECTOR(UART0_RX, isr_uart0_rx); //Define interrupt routine
IRQ0ENH |= 0x10; //Set interrupt Priority High
IRQ0ENL |= 0x10; //Set interrupt Priority
}
void send(char c)
{
/*UART0*/
while (!(U0STAT0 & 0x04)); //Transmit Daata register enabled
U0TXD = c; //Send data
}
//////////////////////////////////
//Transmit string
// and wait till response is complete
void Tx_String(char*sptr)
{
for(;*sptr;++sptr){
if(*sptr == 0x0A)
send(0x0D);
else
send(*sptr);
}
}
void WaitRX(void)
{
rxptr = Rx;
rxlen=0;
rxtmr=45;
while(rxtmr>0);
}
void WaitRX2(void)
{
rxptr = Rx;
rxlen=0;
rxtmr=500; //300ms response time allowance
while(rxtmr>0){}
while((Rx[rxlen-1] !=0x0A || (Rx[rxlen-3] !='K' && Rx[rxlen-3] !='R')) && (rxtmr>0)){}
}
anemokid (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#629
Re:Led Matrix Board via SMS using Zilog encore 2 Years, 3 Months ago Karma: 0
while(counter3 >0)
{
clock();
strobe();
PBCUT &= ~DAT;
temp = *pointer;
PCOUT = ~temp;
PCDD = ~temp;
for(temp = 50; temp > 0; temp--)
{}
PCOUT = 0xFF;
PCDD = 0xFF;
pointer--;
counter3--;
}

if i am not mistaken, counter3 determines the number of blocks in the display? which variable handles the row? i've have'nt read your code line by line coz it makes me dizzy...
asimo (User)
Junior Boarder
Posts: 20
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Philippines Birthday: 03/02
The administrator has disabled public write access.
 
#630
Re:Led Matrix Board via SMS using Zilog encore 2 Years, 3 Months ago Karma: 0
Im not sure about the row...

The main problem in our thesis is that we don't have the header files...
I hope we'll find those header files.. we have to finish this project before monday.. Its already our defense on tuesday.. ugghh..
anemokid (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 123