1 2 3 Previous Next 31 Replies Latest reply on Apr 27, 2020 1:35 AM by MoTa_728816 Go to original post
      • 15. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
        BragadeeshV_41

        Please share your project file. Follow the below steps:

        Archiving a PSoC Creator Design

         

        There are two dedicated SCB (Serial Communication Blocks) in the PSoC device you have chosen. I hope you have other SCB block (I2C/ SPI) in your design. If that is the case, you can try to use an UDB block for UART - UART [v2.50] . A UDB is a flexible, programmable digital block inside a PSoC device that is designed to realize synchronous State Machines such as UART, Counter etc when dedicated resources are exhausted.

         

        The code for handling the ISR could be different. Use the component datasheet (Right click component in Top design and choose datasheet) for programming.

         

        Let us know if this helps

         

        Regards,

        Bragadeesh

        1 of 1 people found this helpful
        • 16. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
          Rach_4524011

          successfully done using another method. but my newIMG_20200418_185123.jpgIMG_20200418_185043.jpg task is now that

           

          i have two uarts assigned in it and now i have named on of them as gsm uart as i have to connect "gsm modem" to the "microcontroller" and micro controller is connected to pc..

          now i have to write at cammands from pc which goes to micro controller and from micro controller to gsm modem, which then replies to the AT commands i have written and the reply goes to the micro controller and micro controller to pc.

           

          for eg :

          I WRITE"AT" FROM PC..

          GOES TO MICRO CONTROLLER AND THEN FROM MICRO CONTROLLER TO GSM

          GSM GETS AT AS THE COMMAND..

           

          NOW GSM RESPONDS "OK" WHICH GOES TO MICRO CONTROLLER AND MICRO CONTROLLER TO PC..

           

          INTERRUPTS ARE THERE ALREADY..

           

          PLEASE GIVE ME A PROGRAM AS I M STUCK WITH PROGRAMMING..

          • 17. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
            BragadeeshV_41

            Please refer the Application Programming Interface section from the component datasheet to send and receive data using the UART component.

            https://www.cypress.com/documentation/component-datasheets/psoc-4-serial-communication-block-scb

             

            You can refer the below post for reference :

            tty_utils a utility sample for CLI type program

             

            We will be able to help you if you run into any specific issues while programming. Use the Code example shared previously to send and receive data using UART.

             

            Regards,

            Bragadeesh

            • 18. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
              Rach_4524011

              no bragadeesh still not getttingi it.. please help.. the example showed is not of my use any how..

               

              please where to start help

              • 19. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                MoTa_728816

                Hi,

                 

                If you directly connect 2 uarts out of available 2 uarts, debugging may not be very easy.

                So I used CY8CKIT-044 which has 3 UARTs and made the following sample.

                Note: I also mad one for CY8C4125AXI-483 at the bottom, so don't go now ;-)

                 

                === CY8CKIT-044 Version ===

                The schematic,

                001-schematic.JPG

                Pins

                002-pins.JPG

                main.c

                ==============

                #include "project.h"

                #include "stdio.h"

                 

                #define TAB   '\t'

                #define SPACE ' '

                #define CR    '\r'

                #define LF    '\n'

                 

                static inline int is_delimiter(char c)

                {

                    return((c == TAB)||(c == SPACE)||(c == CR)||(c == LF)) ;

                }

                 

                static inline int is_eol(char c)

                {

                    return((c == CR) || (c == LF)) ;

                }

                 

                #define RX_BUF_LEN 32

                #define STR_LEN    32

                 

                volatile uint8_t cmd_buf[RX_BUF_LEN] ;

                volatile uint8_t gsm_buf[RX_BUF_LEN] ;

                 

                volatile int cmd_write_index = 0 ;

                volatile int gsm_write_index = 0 ;

                 

                int cmd_read_index = 0 ;

                int gsm_read_index = 0 ;

                 

                int str_gsm_index = 0 ;

                int str_cmd_index = 0 ;

                 

                char cmd_str[STR_LEN+1] ;

                char gsm_str[STR_LEN+1] ;

                 

                char str[STR_LEN+1] ;

                void print(char *str)

                {

                    UART_UartPutString(str) ;

                }

                 

                void cls(void)

                {

                    print("\033c") ; /* reset */

                    CyDelay(20) ;

                    print("\033[2J") ; /* clear screen */

                    CyDelay(20) ;

                }

                 

                CY_ISR(ISR_CMD_Handler)

                {

                    if (UART_CMD_SpiUartGetRxBufferSize()) {

                        cmd_buf[cmd_write_index] = UART_CMD_UartGetByte() ;

                        cmd_write_index = (cmd_write_index + 1) % RX_BUF_LEN ;

                    }

                    UART_CMD_ClearRxInterruptSource(UART_CMD_INTR_RX_NOT_EMPTY) ;

                }

                 

                CY_ISR(ISR_GSM_Handler)

                {

                    if (UART_GSM_SpiUartGetRxBufferSize()) {

                        gsm_buf[gsm_write_index] = UART_GSM_UartGetByte() ;

                        gsm_write_index = (gsm_write_index + 1) % RX_BUF_LEN ;

                    }

                    UART_GSM_ClearRxInterruptSource(UART_GSM_INTR_RX_NOT_EMPTY) ;

                }

                 

                void init_hardware(void)

                {

                    CyGlobalIntEnable; /* Enable global interrupts. */   

                   

                    ISR_CMD_ClearPending() ;

                    ISR_CMD_StartEx(ISR_CMD_Handler) ;

                   

                    ISR_GSM_ClearPending() ;

                    ISR_GSM_StartEx(ISR_GSM_Handler) ;

                   

                    UART_CMD_Start() ;

                    UART_GSM_Start() ;

                   

                    UART_Start() ; // for CY8CKIT-044

                }

                 

                int cmd_get_string(void)

                {

                    int result = 0 ; 

                   

                    if (cmd_read_index != cmd_write_index) {

                        if (is_eol(cmd_buf[cmd_read_index])) {

                            cmd_str[str_cmd_index] = 0 ;

                            result = str_cmd_index ;

                            str_cmd_index = 0 ;

                        } else {

                            cmd_str[str_cmd_index++] = cmd_buf[cmd_read_index] ;

                            if (str_cmd_index >= STR_LEN) {

                                cmd_str[STR_LEN] = 0 ;

                                str_cmd_index = 0 ;

                                result = -1 ;   

                            }

                        }

                        cmd_read_index = (cmd_read_index + 1) % RX_BUF_LEN ;

                    }   

                    return(result) ;

                }

                 

                int gsm_get_string(void)

                {

                    int result = 0 ; 

                   

                    if (gsm_read_index != gsm_write_index) {

                        if (is_eol(gsm_buf[gsm_read_index])) {

                            gsm_str[str_gsm_index] = 0 ;

                            result = str_gsm_index ;           

                            str_gsm_index = 0 ;

                        } else {

                            gsm_str[str_gsm_index++] = gsm_buf[gsm_read_index]  ;

                            if (str_gsm_index >= STR_LEN) {

                                gsm_str[STR_LEN] = 0 ;

                                str_gsm_index = 0 ;

                                result = -1 ; /* buffer over flow */

                            }

                        }

                        gsm_read_index = (gsm_read_index + 1) % RX_BUF_LEN ;       

                    }   

                    return(result) ;

                }

                 

                int main(void)

                {

                    int cmd_count = 0 ;

                    int gsm_count = 0 ;

                   

                    init_hardware() ;

                   

                    cls() ;

                    print("Cross UART Test ") ;

                    snprintf(str, STR_LEN, "(%s %s)\n\r", __DATE__, __TIME__) ;

                    print("\n\r") ;

                   

                    UART_CMD_UartPutString("Hello!\n") ;

                    CyDelay(10) ;

                   

                    for(;;)

                    {

                        if (gsm_get_string()) { /* uart_gsm got a word */

                            // received word is gsm_str[]

                            snprintf(str, STR_LEN, "gsm received \"%s\"\n\r", gsm_str) ;

                            print(str) ;

                            snprintf(str, STR_LEN, "Kon-nichi-wa %d !\n",gsm_count++) ;

                            UART_GSM_UartPutString(str) ;

                            if (gsm_count > 100) {

                                gsm_count = 0 ;

                            }

                            CyDelay(10) ;

                        }

                        if (cmd_get_string()) { /* uart_cmd got a word */

                            // received word is cmd_str[]

                            snprintf(str, STR_LEN, "cmd recived \"%s\"\n\r", cmd_str) ;

                            print(str) ;

                            CyDelay(10) ;

                            snprintf(str, STR_LEN, "Hello %d !\n", cmd_count++) ;

                            UART_CMD_UartPutString(str) ;

                            if (cmd_count > 100) {

                                cmd_count = 0 ;

                            }

                            CyDelay(1000) ;

                        }

                    }

                }

                ==============

                 

                Tera Term log

                Note: "Kon-nichi-wa" means "Hello" in Japanese.

                000-TeraTerm-log.JPG

                So at least on CY8CKIT-044 two uarts are communicating OK.

                 

                Now time for CY8C4125AXI-483

                schematic

                010-schematic.JPG

                pins

                NOTE: Since I don't know which pin you need to use, I just let the compiler assign the pins.

                So please assign pins you need to use.

                012-pins.JPG

                main.c

                Note: This is the version I removed the third UART form the project.

                And it is compile-able, but I have not test it.

                ======================

                #include "project.h"

                #include "stdio.h"

                 

                #define TAB   '\t'

                #define SPACE ' '

                #define CR    '\r'

                #define LF    '\n'

                 

                static inline int is_delimiter(char c)

                {

                    return((c == TAB)||(c == SPACE)||(c == CR)||(c == LF)) ;

                }

                 

                static inline int is_eol(char c)

                {

                    return((c == CR) || (c == LF)) ;

                }

                 

                #define RX_BUF_LEN 32

                #define STR_LEN    32

                 

                volatile uint8_t cmd_buf[RX_BUF_LEN] ;

                volatile uint8_t gsm_buf[RX_BUF_LEN] ;

                 

                volatile int cmd_write_index = 0 ;

                volatile int gsm_write_index = 0 ;

                 

                int cmd_read_index = 0 ;

                int gsm_read_index = 0 ;

                 

                int str_gsm_index = 0 ;

                int str_cmd_index = 0 ;

                 

                char cmd_str[STR_LEN+1] ;

                char gsm_str[STR_LEN+1] ;

                char str[STR_LEN+1] ;

                 

                CY_ISR(ISR_CMD_Handler)

                {

                    if (UART_CMD_SpiUartGetRxBufferSize()) {

                        cmd_buf[cmd_write_index] = UART_CMD_UartGetByte() ;

                        cmd_write_index = (cmd_write_index + 1) % RX_BUF_LEN ;

                    }

                    UART_CMD_ClearRxInterruptSource(UART_CMD_INTR_RX_NOT_EMPTY) ;

                }

                 

                CY_ISR(ISR_GSM_Handler)

                {

                    if (UART_GSM_SpiUartGetRxBufferSize()) {

                        gsm_buf[gsm_write_index] = UART_GSM_UartGetByte() ;

                        gsm_write_index = (gsm_write_index + 1) % RX_BUF_LEN ;

                    }

                    UART_GSM_ClearRxInterruptSource(UART_GSM_INTR_RX_NOT_EMPTY) ;

                }

                 

                void init_hardware(void)

                {

                    CyGlobalIntEnable; /* Enable global interrupts. */   

                   

                    ISR_CMD_ClearPending() ;

                    ISR_CMD_StartEx(ISR_CMD_Handler) ;

                   

                    ISR_GSM_ClearPending() ;

                    ISR_GSM_StartEx(ISR_GSM_Handler) ;

                   

                    UART_CMD_Start() ;

                    UART_GSM_Start() ;

                }

                 

                int cmd_get_string(void)

                {

                    int result = 0 ; 

                   

                    if (cmd_read_index != cmd_write_index) {

                        if (is_eol(cmd_buf[cmd_read_index])) {

                            cmd_str[str_cmd_index] = 0 ;

                            result = str_cmd_index ;

                            str_cmd_index = 0 ;

                        } else {

                            cmd_str[str_cmd_index++] = cmd_buf[cmd_read_index] ;

                            if (str_cmd_index >= STR_LEN) {

                                cmd_str[STR_LEN] = 0 ;

                                str_cmd_index = 0 ;

                                result = -1 ;   

                            }

                        }

                        cmd_read_index = (cmd_read_index + 1) % RX_BUF_LEN ;

                    }   

                    return(result) ;

                }

                 

                int gsm_get_string(void)

                {

                    int result = 0 ; 

                   

                    if (gsm_read_index != gsm_write_index) {

                        if (is_eol(gsm_buf[gsm_read_index])) {

                            gsm_str[str_gsm_index] = 0 ;

                            result = str_gsm_index ;           

                            str_gsm_index = 0 ;

                        } else {

                            gsm_str[str_gsm_index++] = gsm_buf[gsm_read_index]  ;

                            if (str_gsm_index >= STR_LEN) {

                                gsm_str[STR_LEN] = 0 ;

                                str_gsm_index = 0 ;

                                result = -1 ; /* buffer over flow */

                            }

                        }

                        gsm_read_index = (gsm_read_index + 1) % RX_BUF_LEN ;       

                    }   

                    return(result) ;

                }

                 

                 

                int main(void)

                {

                    int cmd_count = 0 ;

                    int gsm_count = 0 ;

                   

                    init_hardware() ;

                   

                    UART_CMD_UartPutString("Hello!\n") ;

                    CyDelay(10) ;

                   

                    for(;;)

                    {

                        if (gsm_get_string()) { /* uart_gsm got a word */

                            // received word is gsm_str[]

                            snprintf(str, STR_LEN, "Kon-nichi-wa %d !\n",gsm_count++) ;

                            UART_GSM_UartPutString(str) ;

                            if (gsm_count > 100) {

                                gsm_count = 0 ;

                            }

                            CyDelay(10) ;

                        }

                        if (cmd_get_string()) { /* uart_cmd got a word */

                            // received word is cmd_str[]

                            snprintf(str, STR_LEN, "Hello %d !\n", cmd_count++) ;

                            UART_CMD_UartPutString(str) ;

                            if (cmd_count > 100) {

                                cmd_count = 0 ;

                            }

                            CyDelay(1000) ;

                        }

                    }

                }

                ======================

                 

                Use two_uart_200419_044 for CY8CKIT-044

                Use tow_uart_200419 for CY8CKIT-049,

                if your MPU is not CY8C4125AXI-483, change the device and pin assignment.

                 

                moto

                • 20. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                  Rach_4524011

                  I HAVE MADE A PROGRAM TO SEND AT COMMAND AND GET OK IN RESPONSE.. I HAVE DEVELOPED IT BUT WHEN I TYPE AT

                  I DONT GET AT IN RESPONSE..

                  WHEN I PRESS ENTER IT JUST GETS TO NEW LINE AND DOESNT NOT GET OK..

                   

                  CAN IT BE DUE TO LOOSE CONNECTION OR ANY OTHER ISSUE IS THERE??

                  • 21. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                    MoTa_728816

                    Hi,

                     

                    As far as I know of many (if not all) programs do not work correctly at first,

                    then you need to perform an operation called "debugging."

                     

                    If you could attach your project with your response,

                    others may be able to check the code.

                     

                    But without seeing your project or code, all we can say is

                    "Yes, it may be the connection and it may be because of other issues, too."

                     

                    Well, at least what I can say now is,

                    Have you tried a loop back test?

                    Which you connect tx and rx of one uart, so that any input of the uart

                    should be echoed back to the same uart.

                     

                    And have you tried my sample code?

                    Did it work or it did not work as I showed in my response?

                    Or was my work just in vain?

                     

                    moto

                    • 22. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                      Rach_4524011

                      SO IHAVE NOT TRIED YOUR CODE BT I WANT TO NOW DO A NEW TASKK IN WHICH I HAVE 2 UART, A PC, PSOC AND GSM MODEM...

                       

                      AS FOR NOW I AM SENDING COMMANDS THROUGH PC BUT NOW I WANT TO SEND COMMANDS DIRECTLY MICRONTROLLER TO GSM AND THE PORT IS OPENED AND ETC. '

                      FOR EG: I WRITE CONNECT ON PUTTY.. DIRECTLY MICROCONTROLLER GETS CONNECTED TO GSM AND THE COMMANDS PROGRAM TAKE PLACE AND PORT IS OPENED DIRECTLY...

                      • 23. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                        MoTa_728816

                        So you are not willing to listen to us / me.

                        Then I wonder how we can be any help of you?

                         

                        Having written above, since I have spent rather long time to prepare the samples, let me write the following.

                        But as always, you are free to ignore anything.

                         

                        From your last reply, I imaged that you can do

                        020-PC-GSM.JPG

                        But you are not able to do

                         

                        021-PC-PSoC-GSM.JPG

                        So I think I wrote another sample which will do the above.

                        But as I don't have a board with the PSoC device,

                        I could not test it at my side.

                         

                        I hope that you will download and try the sample, but as usual, it's not mandatory ;-)

                         

                        moto

                        • 24. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                          Rach_4524011

                          can ypu explain me the project you have sent.. as i am very new to programming.. i wasnt able to understand some of the lines in the main.. so if i type connect then the microcontroller directly gets connected to gsm modem and etc... ??

                           

                          plz explain me your code

                          • 25. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                            Rach_4524011

                            for eg: i write connect in putty, then thr micro controller does it job, of directly connecting the microcontroller to gsm modem..

                             

                            all the cammds gets executed automcatically and it open the port of server and etc.

                            • 26. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                              MoTa_728816

                              Hi,

                               

                              I'm not sure how far we need to go.

                              But anyway let me try.

                               

                              I'm going to try to explain the newest project "two_uart_200425."

                               

                              It has two uarts,

                              (1) UART_CMD

                                   This is supposed to be connected to your PC.

                                   So your serial terminal program, such as Putty(?) (I usually use Tera Term here) talk and listen with this UART component.

                               

                              (2) UART_GSM

                                   This is suppoed to be connected to your GSM modem.

                                   So MCU and GSM modem will talk/listen via this UART component.

                               

                              And each components has interrupt connected.

                              The interrupt is configured to let the program jump to its associated interrupt service routine (ISR).

                               

                              Since both UART_CMD and UART_GSM works the same way, let's only talk about UART_CMD here.

                               

                              If in your PC, you type a letter into Putty, a letter is sent to UARD_CMD's rx (receiver)

                              and it causes the interrupt triggered.

                               

                              Then ISR_CMD_Handler is called automatically.

                               

                              In ISR_CMD_Handler, if there is a byte (or more) received by UART_CMD

                              the size of it's RxBuffer is more than 0, so I take one byte for the buffer by

                                 cmd_buf[cmd_write_index] = UART_CMD_UartGetByte() ;

                               

                              And I increase cmd_write_indx by 1, but if it gets the last byte, it will start from the first byte again,

                              so that it will form what we call "ring buffer".

                              After doing above, I clear the interrupt flag then return from ISR_CMD_Handler

                               

                              Note: Although I'm clearing interrupt flag for UART_CMD_INTR_RX_NOT_EMPTY,

                                 if there is/are left over received byte(s) this interrupt will be called again.

                              ===================

                              CY_ISR(ISR_CMD_Handler)

                              {

                                  if (UART_CMD_SpiUartGetRxBufferSize()) {

                                      cmd_buf[cmd_write_index] = UART_CMD_UartGetByte() ;

                                      cmd_write_index = (cmd_write_index + 1) % RX_BUF_LEN ;

                                  }

                                  UART_CMD_ClearRxInterruptSource(UART_CMD_INTR_RX_NOT_EMPTY) ;

                              }

                              ===================

                               

                              Then I prepared a function "int cmd_get_string()", which will copy a letter

                              from the ring-buffer  to a string array "cmd_str[]".

                               

                              During the receiving loop, it always returns 0,

                              but when it notices that an EOL letter such as '\r' or '\n' is received,

                              then it terminates the string with copying a NULL (0) at the last byte of cmd_str[]

                              and returns the length of the string, which is str_cmd_index.

                               

                              Or in case the length of cmd_str[] which is counted by using str_cmd_index

                              exceeds the STR_LEN, it forces to close the string by writing NULL (0)

                              at cmd_str[STR_LEN]. and returns -1.

                               

                              ===================

                              int cmd_get_string(void)

                              {

                                  int result = 0 ; 

                                 

                                  if (cmd_read_index != cmd_write_index) {

                                      if (is_eol(cmd_buf[cmd_read_index])) {

                                          cmd_str[str_cmd_index] = 0 ;

                                          result = str_cmd_index ;

                                          str_cmd_index = 0 ;

                                      } else {

                                          cmd_str[str_cmd_index++] = cmd_buf[cmd_read_index] ;

                                          if (str_cmd_index >= STR_LEN) {

                                              cmd_str[STR_LEN] = 0 ;

                                              str_cmd_index = 0 ;

                                              result = -1 ;   

                                          }

                                      }

                                      cmd_read_index = (cmd_read_index + 1) % RX_BUF_LEN ;

                                  }   

                                  return(result) ;

                              }

                              ===================

                               

                              Now from the main loop, I can only call and check the return value of cmd_get_string() repeatedly.

                              Something like

                               

                              int main(void)

                              {

                              ...

                                   for ( ; ; ) {

                                        if (cmd_get_string()) {

                                               /* if we came here, this means there is a received string in the "cmd_str[]"

                                        }

                                   }

                              }

                               

                              Then if cmd_get_string() returned non-zero value, I'm sending the string to the GSM modem by calling

                                   UART_GSM_UartPutSring(cmd_str) ;

                                   and added an EOL by

                                   UART_GSM_UartPutString("\n\r") ;

                               

                              For receiving answer from GSM modem, I did the same thing, but function names were

                               ISR_GSM_Handler

                                  gsm_get_string

                               

                              so the main loop can test and notice if GSM returned something.

                              then I returned the gsm_str to the UART_CMD by using "print()" funciton.

                                 print(gsm_str) ;

                                 print("\n\r") ;

                               

                              Additionally I added a utility function "prompt()" which only writes "> "

                              to notice the user that the program is ready to receive a new command.

                               

                              Finally the main() looked like

                              ======================

                              int main(void)

                              {

                                  init_hardware() ;

                                 

                                  splash("PC to GSM modem test") ;

                                 

                                  prompt() ;

                                  for(;;)

                                  {

                                      if (gsm_get_string()) { /* got a string from GSM Modem */

                                          print(gsm_str) ;

                                          print("\n\r") ;

                                          prompt() ;

                                          CyDelay(10) ;

                                      }

                                      if (cmd_get_string()) { /* got a string form PC */

                                          UART_GSM_UartPutString(cmd_str) ;

                                          UART_GSM_UartPutString("\r\n") ; /* send a terminator */

                                      }

                                  }

                              }

                              ======================

                               

                              Now if you'd like to have some macro or sequence type operation,

                              you could do

                                UART_GST_UartPutSTring("AT....") ;

                                while(gsm_get_seting()) {} ; /* wait for gsm to answer */

                                if (strcmp(gsm_str, "OK")==0) { /* gsm answered "OK" */

                                   // do something next

                                } else { /* gsm answered otherwise */

                                  // take care of error situation

                                }

                               

                              Anyway, from here, it's your "Project".

                              So you are on your own.

                               

                              moto

                              • 27. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                                Rach_4524011

                                  UART_GST_UartPutSTring("AT....") ;

                                  while(gsm_get_seting()) {} ; /* wait for gsm to answer */

                                  if (strcmp(gsm_str, "OK")==0) { /* gsm answered "OK" */

                                     // do something next

                                  } else { /* gsm answered otherwise */

                                    // take care of error situation

                                  }

                                 

                                WHERE TO PUT THE ABOVE CAMMND IN THE PROGRAM

                                • 28. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                                  MoTa_728816

                                  Hi,

                                   

                                  > WHERE TO PUT THE ABOVE CAMMND IN THE PROGRAM

                                  It's totally up to you.

                                  But saying this won't answer you.

                                   

                                  So let's see...

                                   

                                  If I were you, I would write something like

                                   

                                  ===============

                                  /*

                                  * do_gsm_init()

                                  * Note: "command to initialize" should be replaced with some meaningful command

                                  * such as "AT"

                                  */

                                  void do_gsm_init(void)

                                  {

                                         UART_GSM_UartPutString("command to initialize") ;

                                         UART_GSM_UartPutString("\r\n") ;

                                         while(gsm_set_string() == 0) { /* wait for gsm to answer */ }

                                         print(gsm_str) ;

                                         print("\n\r") ;

                                  }

                                   

                                  /*

                                  * do_gsm_commandA()

                                  * Note: "command to command A" should be replaced with some meaningful command

                                  * such as "ATA", "ATDT12346", (btw, I don't know about your GSM modem command)

                                  */

                                  void do_gsm_commandA(void)

                                  { 

                                         UART_GSM_UartPutString("command for command A") ;

                                         UART_GSM_UartPutString("\r\n") ;

                                         while(gsm_set_string() == 0) { /* wait for gsm to answer */ }

                                         print(gsm_str) ;

                                         print("\n\r") ;

                                  }

                                   

                                  int main(void)

                                  {

                                  ...

                                      prompt() ;

                                      for (;;) {

                                          if (cmd_get_string()) {

                                             if (strcmp(cmd_str, "init") == 0) { /* init command for gsm */

                                                do_gsm_init() ;

                                              } else if (strcmp(cmd_str, "commandA") == 0) { /* commandA for gsm */

                                                do_gsm_commandA() ;

                                              } else {

                                                 print("Unknown command: ") ;

                                                 print(cmd_str) ;

                                                 print("\n\r") ;

                                              }

                                             prompt() ;

                                          }

                                      }

                                  }

                                  ===============

                                   

                                  moto

                                  • 29. Re: UART RX INTERRUPT PROGRAM FOR CY8CKIT 49
                                    Rach_4524011

                                    in the whole program, where to put the above.. after which line.. ?? programming is notmy cup oftea.. but still if you helpme by just putting the above command in proper place in program? then i would study the whole..

                                     

                                     

                                    after this once the program is build.. what should be the next step.. how to connect and all..?