Can not execute PutTmplt command

General discussion on RSC-4x mikroC.
Post Reply
Author
Message
hamunnaptra
Posts: 1
Joined: 16 May 2007 17:59

Can not execute PutTmplt command

#1 Post by hamunnaptra » 16 May 2007 18:07

I have written a simple code for beginning, I am getting sound and creating templates. I have written this code:

Code: Select all

#include <techlib.h>
#define TEMPLATES 5
#define TIMEOUT 2
 void main()
 {
 typedef struct {
           uchar    pp_a;
           uchar    pp_b;
           uchar    pp_r0;
           uchar    pp_r1;
           uchar    pp_r2;
           uchar    pp_r3;
           uchar    pp_r4;
           uchar    pp_r5;
           }PARAMETERPASS;

 PARAMETERPASS results;
 uchar index=1;
 uchar error;
 uchar error1;
     _Init232();
     _SetBaudRate(BAUD9600);
     _InitCollection();
     _PutTmpltListBase(TEMPLATES);
     _Send232D8(_GetTmpltListBase());
    _Send232D8(01);
    while(1)
    {
    _SysBeep(200);
     error = _MakeTmpltSd(TIMEOUT,2,1);
     _Send232D8(error);
     if(error==0x00)
     {
     p0out = 0b00000011;
    _PutTmplt(index);
    _Send232D8(02);
     break;
     }
    }
    index++;
     while(1)
    {
    _SysBeep(50);
     error1 = _MakeTmpltSd(TIMEOUT,2,1);
     if(error1==ERR_OK)
     {
     p0out = 0b00000001;
    _PutTmplt(index);
    _Send232D8(03);
     break;
     }
    }
    _Send232D8(04);
    _Crlf232();                 // Echo Carriage Return/Line Feed
    _Idle232();                 // Turn off RS232
    _SleepIO(0,0,0);            // Low power sleep



  }
I use Easy-VR Stamp. As you can see from my code I use rs232 communication to verify that the program executes all the steps. But I can see from hyper terminal the program stops at PutTmplt command. How can I fix this problem ?
thank you very much.

bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

#2 Post by bruno » 03 Jun 2007 13:41

Hello,

with this code :

Code: Select all

_PutTmpltListBase(TEMPLATES); 
the next template access will hang if you use the on-chip memory, because you set the template list base by your own.
either link your code with mem24xxx-400khz for example to use SEEPROM (ensure also I²C SEEPROM connections are free on RSC2128 MCU),
or link with memRSC4x.mcl file to use on-chip memory, and get template base address with _GetOnchipTmpltBase().

this code will allow to use either on-chip or external memory :

Code: Select all

        if (_DeviceGetInfo() & ONCHIP)
                {
                firstTmplt = _GetOnchipTmpltBase() ; // on chip memory, the system gives the start address, link with memRSC4x.mcl
                }
        else
                {
                firstTmplt = TEMPLATES ;  // external memory, the user gives the start address, link with external memory driver
                }
        _PutTmpltListBase(firstTmplt) ; 
Bruno

Post Reply

Return to “RSC-4x mikroC General”