Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - tr111

Pages: 1 2 [3]
31
µTasker general / Also about the uart get data!
« on: September 08, 2007, 10:40:45 AM »
 When I send the data to the uart.data=(0x11,0x22,0x33,0x44,0x55)
       like this:
       #else
        if ((iAppState & (STATE_ACTIVE | STATE_DELAYING | STATE_ESCAPING | STATE_RESTARTING | STATE_VALIDATING)) && (Length = fnMsgs(SerialPortID))) {
            while ((Length = fnRead( SerialPortID, ucInputMessage, MEDIUM_MESSAGE)) != 0) {
                fnEchoInput(ucInputMessage, Length);
                fnDebugMsg("\n\rLED ON OFF\n\r");
                if (usData_state == ES_NO_CONNECTION) {
                    if (fnCommandInput(ucInputMessage, Length, SOURCE_SERIAL)) {
                        if (fnInitiateLogin(ES_SERIAL_LOGIN) == TELNET_ON_LINE) {
                            static const CHAR ucCOMMAND_MODE_BLOCKED[] = "Command line blocked\r\n";
                            fnWrite(SerialPortID, (unsigned char *)ucCOMMAND_MODE_BLOCKED, sizeof(ucCOMMAND_MODE_BLOCKED));
                        }
                    }
                }
       I find the Length always 1,and printf the "LED ON OFF" five times! Why!
       I want the get the data(0x11,0x22,0x33,0x44,0x55) is a long buff,not the CHAR_MODE one by one!
       I want the Length is 5 not 1,so that I can easy to use the buff.not like the char!
       

     When I #define TEST_MSG_MODE,but it never go to the
     #ifdef TEST_MSG_MODE
          #ifdef TEST_MSG_CNT_MODE
            while (fnMsgs(SerialPortID)) {
                unsigned char ucLength;

                fnRead( SerialPortID, &ucLength, 1);                     // get message length
                Length = fnRead( SerialPortID, ucInputMessage, ucLength);
              fnDebugMsg("\n\rLED ON 1OFF\n\r");
                fnEchoInput(ucInputMessage, ucLength);
            }
          #else
            while (fnMsgs(SerialPortID)) {
                Length = fnRead( SerialPortID, ucInputMessage, MEDIUM_MESSAGE);
                 fnDebugMsg("\n\rLED2 ON OFF\n\r");
                fnEchoInput(ucInputMessage, Length);
            }
          #endif
fnMsgs(SerialPortID); This is called to return the number of waiting messages. In character mode this is equal to the number of characters but in message mode it will indicate the number of complete messages and not individual characters.
   how can I get the "in message mode",I want to get complete messages and not individual characters!


32
µTasker general / How to use the UART to get data and send data!
« on: September 07, 2007, 10:13:34 AM »
hello:
     How to use the UART to get data and send data! I only the Tty_drv.c is the uart driver!
      when I send the data to the mcf52235 ,it will auto send back to me now! I don't why?
     Now  I want to get the data from UART and send to the ETH!
    But I don't know how the get the  UART data and send the data by UART!
   Regards

tr111

33
µTasker general / about the sprintf(........)!I can't use !
« on: September 06, 2007, 09:27:52 AM »
I do that:

1. Remove typedef unsigned int size_t; from types.h
2. Add #include <stdio.h> at the line after #include "types.h" in config.h
3.#included <stdio.h>
4.sprintf(buffer, "err=%d \n",err); infnADC;


but in the CodeWarrior IDE

Link Error   : Undefined : "sprintf"
Referenced from "fnADC" in Watchdog.c

Link failed.

/*stdio.h*/

/* MSL
 * Copyright ?1995-2006 Freescale Corporation.  All rights reserved.
 *
 * $Date: 2006/02/08 20:34:05 $
 * $Revision: 1.35.2.3 $
 */

#ifndef _MSL_STDIO_H
#define _MSL_STDIO_H

#include <ansi_parms.h>

#if !_MSL_USING_MW_C_HEADERS
   #error You must have the non-MSL C header file access path before the MSL access path
#else

#include <cstdio>

#if defined(__cplusplus) && defined(_MSL_USING_NAMESPACE)
   using std::FILE;
   using std::fpos_t;
   using std::size_t;
   using std::clearerr;
   using std::fclose;
   using std::feof;
   using std::ferror;
   using std::fflush;
   using std::fgetc;
   using std::fgetpos;
   using std::fgets;
#if _MSL_OS_DISK_FILE_SUPPORT
   using std::fopen;
   using std::fprintf;
#endif /* _MSL_OS_DISK_FILE_SUPPORT */   /*- mm 030319 -*/
   using std::fputc;
   using std::fputs;
   using std::fread;
#if _MSL_OS_DISK_FILE_SUPPORT
   using std::freopen;
#endif /* _MSL_OS_DISK_FILE_SUPPORT */
   using std::fscanf;
   using std::fseek;
   using std::fsetpos;
   using std::ftell;
   using std::fwrite;
   using std::getc;
   using std::getchar;
   using std::gets;
#if _MSL_OS_DISK_FILE_SUPPORT   
   using std::perror;
#endif /* _MSL_OS_DISK_FILE_SUPPORT */
   using std::printf;
   using std::putc;
   using std::putchar;
   using std::puts;
#if _MSL_OS_DISK_FILE_SUPPORT
   using std::remove;
   using std::rename;
#endif /* _MSL_OS_DISK_FILE_SUPPORT */
   using std::rewind;
   using std::scanf;
   using std::setbuf;
   using std::setvbuf;
   using std::sprintf;
   using std::snprintf;
   using std::sscanf;
#if _MSL_OS_DISK_FILE_SUPPORT
   using std::tmpfile;
   using std::tmpnam;
#endif /* _MSL_OS_DISK_FILE_SUPPORT */
   using std::ungetc;
   using std::vfprintf;
   using std::vprintf;
   using std::vsprintf;
   using std::vfscanf;
   using std::vscanf;                  /*- mm 020326 -*/
   using std::vsscanf;
   using std::vsnprintf;
#if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
   using std::errno_t;
   using std::rsize_t;
   using std::fscanf_s;
   using std::scanf_s;
   using std::sscanf_s;
   using std::vfscanf_s;
   using std::vsscanf_s;
   using std::gets_s;
#if _MSL_OS_DISK_FILE_SUPPORT
   using std::fopen_s;
   using std::freopen_s;
   using std::tmpfile_s;
   using std::tmpnam_s;
#endif /* _MSL_OS_DISK_FILE_SUPPORT */
#endif /* __STDC_WANT_SECURE_LIB__ */
#endif /* defined(__cplusplus) && defined(_MSL_USING_NAMESPACE) */

#endif /* _MSL_USING_MW_C_HEADERS */

#endif /* _MSL_STDIO_H */

/* Change record:
 * hh  971206 Created.
 * hh  991112 Fixed using bug.
 * JWW 001208 Added case for targeting Mach-O
 * JWW 011027 Use _MSL_USING_MW_C_HEADERS as generic header test instead of specific Mach-O test
 * mm  020126 Included using vscanf, __unoriented, __wide_oriented, and __char_oriented
 * JWW 030224 Changed __NO_WIDE_CHAR flag into the new more configurable _MSL_WIDE_CHAR
 * mm  030314 Added wrappers for fwide
 * mm  030319 Moved wrapper for _No_Disk_File_OS_Support
 * JWW 031030 Added the __STDC_WANT_SECURE_LIB__ secure library extensions
 * cc  040217 Changed _No_Disk_File_OS_Support to _MSL_OS_DISK_FILE_SUPPORT
 */

34
µTasker general / about the udp get data from PC!
« on: September 06, 2007, 09:08:51 AM »
hello:
      Now I can use the fnSendUDP to send the data!But I want to get the data from the udp! How Can I do!
      I know the  fnHandleUDP's received_ip_packet have data and Header.
I know  If I #define SUPPORT_SUBNET_BROADCAST .I will get the data that I send.

But I don't like to use the #define SUPPORT_SUBNET_BROADCAST ;

      I like this:
      when I send the data to the MCF52235 from PC:source part=1999;
destination port=1999
PC
send:11 22 33 44 55
      I want the MCF52235 can get the data 11 22 33 44 55 ,and send back to
PC:

source part=1999;destination port=1999

MCF5223  get and send :11 22 33 44 55

35
µTasker general / how to use printf() in uTASKER??
« on: August 29, 2007, 10:04:49 AM »
hello:
I have #define <stdio.h>
but the printf() can't use???
I only use the fnDebugMsg("\n\rLED ON OFF\n\r") to display int the  LOG_UART0!
but I need that:
printf("err=%d \n",err);
the fnDebugMsg only can printf text!
I don't know why???

36
µTasker general / also about the udp use!
« on: August 29, 2007, 09:55:23 AM »
hello:
#ifdef SUPPORT_ADC
#define OWN_TASK  TASK_ADC
#define UDP_BUFFER_SIZE        512
#define MY_UDP_PORT            1999
 typedef struct stUDP_MESSAGE
    {
        unsigned short usLength;
        UDP_HEADER     tUDP_Header;                                        // reserve header space
        unsigned char  ucUDP_Message[UDP_BUFFER_SIZE];                   // reserve message space
    } UDP_MESSAGE;
static unsigned char ucUDP_IP_Address[IPV4_LENGTH] = {192, 168, 0, 37}; // address to send UDP test frames to
static USOCKET MyUDP_Socket;
static UDP_MESSAGE *ptrUDP_Frame;
unsigned char *p,buf[8]={0,1,2,3,4,5,6,7};
int err;
static int  fnUDPListner(USOCKET SocketNr, unsigned char ucEvent, unsigned char *ucIP, unsigned short usPortNr, unsigned char *data, unsigned short usLength)
{
   switch (ucEvent) {
   case UDP_EVENT_RXDATA:
      //if (usPortNr != MY_UDP_PORT) break;                            // ignore false ports
      //if (uMemcmp(ucIP, ucUDP_IP_Address, IPV4_LENGTH)) break;       // ignore if not from expected IP address

        //if (usLength <= UDP_BUFFER_SIZE) {                             // ignore frames which are too large
            //uMemcpy(&ptrUDP_Frame->ucUDP_Message, data, usLength);     // Send the received UDP frame back
         //   fnSendUDP(MyUDP_Socket, ucUDP_IP_Address, MY_UDP_PORT, (unsigned char*)&ptrUDP_Frame->tUDP_Header, usLength, OWN_TASK);
        //}
        fnSendUDP(MyUDP_Socket, ucIP, usPortNr, (data - sizeof(UDP_HEADER)), usLength, OWN_TASK); // echo back from transmitting IP and port
      break;

   case UDP_EVENT_PORT_UNREACHABLE:                                     // we have received information that this port is not available at the destination so quit
      break;
   }
   return 0;
}
static void fnConfigUDP(void)
{
    if (!((MyUDP_Socket = fnGetUDP_socket(TOS_MINIMISE_DELAY, fnUDPListner, (UDP_OPT_SEND_CS | UDP_OPT_CHECK_CS))) < 0)) {
        fnBindSocket(MyUDP_Socket, MY_UDP_PORT);                         // Bind socket
        ptrUDP_Frame    = uMalloc(sizeof(UDP_MESSAGE));                  // get some memory for UDP frame
    }
    else {
       return;                                                          // no socket - this must never happen (ensure that enough user UDP sockets have been defined - USER_UDP_SOCKETS in config.h)!!
    }
}



void fnADC(TTASKTABLE *ptrTaskTable)                           
{  //static UDP_MESSAGE *ptrUDP_Frame  = uMalloc(sizeof(UDP_MESSAGE));                  // get some memory for UDP frame
   const unsigned char test_data[] = {1,2,3,4,5,6,7,8};
int i;
//char err[1];
i=1;
    RUN_LED();                                          // hardware dependent
 

 if(i==1) fnConfigUDP(); 
 uMemcpy(&ptrUDP_Frame->ucUDP_Message, test_data, sizeof(test_data));     // Send the received UDP frame back
fnSendUDP(MyUDP_Socket, ucUDP_IP_Address, MY_UDP_PORT, (unsigned char*)&ptrUDP_Frame->tUDP_Header, sizeof(test_data), OWN_TASK);

i++;
if(i==100) i=2;
}
#endif

#ifdef SUPPORT_ADC
  { "ecDA",       fnADC,          NO_QUE,      (DELAY_LIMIT)(2.0 * SEC), (DELAY_LIMIT)(2 * SEC), UTASKER_STOP},  //
fnADC(TTASKTABLE *ptrTaskTable)  maybe run  per (2.0 * SEC)!
but I can get  the udp data at  pc one time!
I want to get  the udp data more ,because per 2 SECOND it will sent ,but only once I can get the data!
and the RUN_LED() is ok! the led can ON or OFF at per (2.0 * SEC)!                                   
WhY???
I want to get
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
after 2.0 * SEC
01 02 03 04 05 06 07 08
......................................

NO like that:
01 02 03 04 05 06 07 08
(over no more )


37
µTasker general / about the udp use!
« on: August 28, 2007, 07:38:27 AM »
hello:
    I have download the uTaskerV1[1].3.0_M5223X_SP3!
    but i don't know how to use the udp to send and get!
     #define DEMO_UDP  but how it can work???
   

Pages: 1 2 [3]