레이블이 Let's Learn C Programming인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Let's Learn C Programming인 게시물을 표시합니다. 모든 게시물 표시

2013년 5월 29일 수요일

C Programming Tutorial - Example 1


Run "IAR Embedded Workbench for ARM".



















Click “File-Open-Workspace” in menu.



















Open “RQ.eww” located in /IAR/6.20.4 folder.

















You can see the below C source template.















Input C source in “void main(void) function”.















NOTE)
- puts() 
     => Send “string” to COM port of PC.
           Put double quotation mark(“ “) for string.
           null character (‘\0’) is included in last part of string automatically.
- putch()
     => Send “character” to COM port of PC.
           Put single quotation mark (‘ ‘) for character.
- void User_Task_Every_10ms(void)
     => It is called by every 10msec (1/100 sec), such as timer function.
           It is normally used for regular operation.
-ASCII code
   => \r : Carriage Return  (for current line)

   => \n : Line Feed (next line)





Example #1


#include "user.h
void main(void)
{
  puts("\r\n\nHello, RQ World!\r\n"); //Output String to PC
  putch('R'); //Output a Character to PC
  putch('Q');
}
void User_Task_Every_10ms(void)
{

}



Compile it by click “Project-Make” in menu, or press F7.

















You can see the compile status and result in the below.

 (errors : 0,  warnings : 0)



































Below is connections for each part.

 (PC ó USB cable ó smart controller ó Li-Poly battery)























Run “RQC Firmware Upgrade Tool”.













Click “Browse” button to load Firmware file (RQ.bin)




















RQ.bin file is selected. Check “Keep RQC Internal Setting”.
This maintains basic configuration of RQ smart controller.

,such as (Zero position setting, IR remote controller…)
































“ERROR” message is shown as below
  if RQ smart controller is NOT ready for upload firmware.














Firmware is downloaded to RQ smart controller.




















Run “Hyper Terminal” software.

Put any name in Name section.




















Hyper Terminal available COM port number is shown as Device Manager Ports section is indicated.
In this example, “COM 3” is used for this project.

















HyperTerminal COM port configuration
  (115200 bps, 8bits, None, 1, None)


























You can see “Connected” section in the below section.


















Press “P” button of RQ smart controller,
then, it shows strings in Hyper Terminal through COM port.



2013년 1월 10일 목요일

C Programming Tutorial - preparation


In this section, you learn "C Programming" with RQ-HUNO.


Software

 1) IAR Embedded Workbench for ARM (version 5.50 or above)
     => C compiler for RQ robot series C programming
     => Download here

          It is recommended to download “Size-limited license – 32K” version.





















 2) USB-UART download cable driver (for XP, Win 7)
   => Driver for USB-UART download cable.
   => Download here











 3) HyperTerminal
   => Terminal communication program (included in Windows XP basically)
   => For Windows 7 user, please download in here  for free trial version.























 4) RQC Firmware Upload Tool
   =>  Firmware (Binary file/”RQ.bin”) for RQ robot to send RQ smart controller
   => Download here













 5) RQC C library
   => C library source for RQ robot C programming
   => Download here



















Hardware