547,432 active members*
2,007 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Registered
    Join Date
    Apr 2013
    Posts
    34

    Long string in C code

    Hi, Tom

    Version 4.35f
    I want to use long constant 2D array string with dependence of RPM on PWM frequency of my spindle. When I paste it in C editor window Kmotion stops working. When I try to #include file with it to my code it does not compile. Looks like there is a length limit.

    Is there any other way to use this array?

    This is the string:
    double spindle_pwm=((5,0.000000),(6,0.000000),(7,0.000000 ),(8,0.000000),(9,0.000000),(10,0.000000),(11,172. 981068),(12,306.17),(13,315.544674),(14,344.282368 ),(15,373.545116),(16,392.323716),(17,427.690896), (18,458.933405),(19,485.601278),(20,530.027746),(2 1,582.118407),(22,606.341335),(23,630.459399),(24, 658.837122),(25,680.600429),(26,702.888783),(27,72 8.641898),(28,752.564990),(29,785.052337),(30,804. 895657),(31,837.743215),(32,857.601289),(33,883.02 4128),(34,914.521600),(35,935.684902),(36,965.9224 56),(37,990.040797),(38,1013.364194),(39,1036.3423 21),(40,1058.900796),(41,1085.073498),(42,1111.471 371),(43,1139.338853),(44,1167.416256),(45,1190.07 9484),(46,1214.827498),(47,1236.140787),(48,1257.9 64363),(49,1291.367026),(50,1314.240124),(51,1335. 013332),(52,1366.586028),(53,1388.154170),(54,1410 .307175),(55,1437.154654),(56,1462.727601),(57,148 8.390542),(58,1516.453289),(59,1534.407247),(60,15 61.960449),(61,1583.678749),(62,1610.136608),(63,1 632.154852),(64,1659.962635),(65,1681.920446),(66, 1708.017914),(67,1739.875010),(68,1760.228372),(69 ,1783.296659),(70,1805.120590),(71,1836.783535),(7 2,1857.166687),(73,1880.609890),(74,1905.448060),( 75,1935.700647),(76,1952.378810),(77,1981.130994), (78,2001.949324),(79,2027.357284),(80,2051.040383) ,(81,2071.199304),(82,2096.217722),(83,2119.960954 ),(84,2147.513757),(85,2170.177037),(86,2185.31074 3),(87,2221.0),(88,2257.0),(89,2294.590836),(90,22 98.220591),(91,2323.358574),(92,2339.018253),(93,2 369.945831),(94,2393.569041),(95,2410.502835),(96, 2443.980117),(97,2459.608871),(98,2499.984601),(99 ,2519.782762),(100,2537.376299),(101,2559.485088), (102,2581.322720),(103,2605.351572),(104,2631.3301 78),(105,2654.623320),(106,2679.146579),(107,2711. 948749),(108,2734.326418),(109,2750.764939),(110,2 774.822293),(111,2803.395448),(112,2828.638030),(1 13,2855.590810),(114,2881.374490),(115,2899.343806 ),(116,2907.548152),(117,2937.170790),(118,2967.36 3026),(119,2989.711600),(120,3001.574874),(121,304 0.645958),(122,3063.519122),(123,3086.647266),(124 ,3090.351968));

  2. #2
    Registered
    Join Date
    Apr 2013
    Posts
    34

    Re: Long string in C code

    Another problem has arisen, I will not create a new topic. I am setting up a new lathe. I set up both axes, they move good in Kmotion step response, from C code and manually in KMotionCNC. But when i try to use G code (like G0 X0 for example) nothing happened. Also I cant move manually by steps both from keyboard with Ctrl and from screen button. When pressed screen button appears message like "Soft Limit Actuator 103126 Limit 1000000 X+ Rapid Traverse Job Halted" although the limits are still very far away.

  3. #3
    Junior Member
    Join Date
    May 2006
    Posts
    3889

    Re: Long string in C code

    Hi mk,


    Since the PWM value is an incrementing value it isn't needed in the array so a simpler 1D array of doubles might be used. Here is ab uexample:


    Code:
    #include "KMotionDef.h"
    
    double spindle_pwm[]={0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
    		172.981068,306.17,315.544674,344.282368,373.545116,392.323716};
    
    main()
    {
    	int i=12;
    	printf("Index %d Value %f\n",i,spindle_pwm[i]);
    }

    Another problem has arisen, I will not create a new topic. I am setting up a new lathe. I set up both axes, they move good in Kmotion step response, from C code and manually in KMotionCNC. But when i try to use G code (like G0 X0 for example) nothing happened. Also I cant move manually by steps both from keyboard with Ctrl and from screen button. When pressed screen button appears message like "Soft Limit Actuator 103126 Limit 1000000 X+ Rapid Traverse Job Halted" although the limits are still very far away.
    Post your Initialization C Program and all of your KMotionCNC Tool Setup Screens
    TK
    http://dynomotion.com

  4. #4
    Registered
    Join Date
    Apr 2013
    Posts
    34

    Re: Long string in C code

    Quote Originally Posted by TomKerekes View Post
    Hi mk,
    Since the PWM value is an incrementing value it isn't needed in the array so a simpler 1D array of doubles might be used. Here is ab uexample:
    It is till too long
    (0 , 0 , 0 , 0 , 0 , 0, 0 , 0 , 0 , 0 , 0 , 172.981068 , 306.17 , 315.544674 , 344.282368 , 373.545116 , 392.323716 , 427.690896 , 458.933405 , 485.601278 , 530.027746 , 582.118407 , 606.341335 , 630.459399 , 658.837122 , 680.600429 , 702.888783 , 728.641898 , 752.56499 , 785.052337 , 804.895657 , 837.743215 , 857.601289 , 883.024128 , 914.5216 , 935.684902 , 965.922456 , 990.040797 , 1013.364194 , 1036.342321 , 1058.900796 , 1085.073498 , 1111.471371 , 1139.338853 , 1167.416256 , 1190.079484 , 1214.827498 , 1236.140787 , 1257.964363 , 1291.367026 , 1314.240124 , 1335.013332 , 1366.586028 , 1388.15417 , 1410.307175 , 1437.154654 , 1462.727601 , 1488.390542 , 1516.453289 , 1534.407247 , 1561.960449 , 1583.678749 , 1610.136608 , 1632.154852 , 1659.962635 , 1681.920446 , 1708.017914 , 1739.87501 , 1760.228372 , 1783.296659 , 1805.12059 , 1836.783535 , 1857.166687 , 1880.60989 , 1905.44806 , 1935.700647 , 1952.37881 , 1981.130994 , 2001.949324 , 2027.357284 , 2051.040383 , 2071.199304 , 2096.217722 , 2119.960954 , 2147.513757 , 2170.177037 , 2185.310743 , 2221 , 2257 , 2294.590836 , 2298.220591 , 2323.358574 , 2339.018253 , 2369.945831 , 2393.569041 , 2410.502835 , 2443.980117 , 2459.608871 , 2499.984601 , 2519.782762 , 2537.376299 , 2559.485088 , 2581.32272 , 2605.351572 , 2631.330178 , 2654.62332 , 2679.146579 , 2711.948749 , 2734.326418 , 2750.764939 , 2774.822293 , 2803.395448 , 2828.63803 , 2855.59081 , 2881.37449 , 2899.343806 , 2907.548152 , 2937.17079 , 2967.363026 , 2989.7116 , 3001.574874 , 3040.645958 , 3063.519122 , 3086.647266 , 3090.351968)

  5. #5
    Junior Member
    Join Date
    May 2006
    Posts
    3889

    Re: Long string in C code

    Why is it too long?

    Can you see you used different syntax?
    TK
    http://dynomotion.com

  6. #6
    Junior Member
    Join Date
    Jun 2014
    Posts
    18

    Re: Long string in C code

    Quote Originally Posted by mk00 View Post
    It is till too long
    (0 , 0 , 0 , 0 , 0 , 0, 0 , 0 , 0 , 0 , 0 , 172.981068 , 306.17 , 315.544674 , 344.282368 , 373.545116 , 392.323716 , 427.690896 , 458.933405
    [....]
    Split & format its string, such as:

    ( 0 , 0 , 0
    , 0 , 0 , 0
    , 0 , 0 , 0
    , 0 , 0
    , 172.981068 , 306.17 , 315.544674
    , 344.282368 , 373.545116 , 392.323716
    , 427.690896 , 458.933405
    [..etc..]

  7. #7
    Registered
    Join Date
    Apr 2013
    Posts
    34

    Re: Long string in C code

    Quote Originally Posted by TomKerekes View Post
    Why is it too long?

    Can you see you used different syntax?
    I cant paste it in C code

    Quote Originally Posted by ukr View Post
    Split & format its string, such as:

    ( 0 , 0 , 0
    , 0 , 0 , 0
    , 0 , 0 , 0
    , 0 , 0
    , 172.981068 , 306.17 , 315.544674
    , 344.282368 , 373.545116 , 392.323716
    , 427.690896 , 458.933405
    [..etc..]
    It is working, thank you!

Similar Threads

  1. String serving machine
    By dmh13433 in forum General Other Machine Discussion
    Replies: 12
    Last Post: 12-01-2018, 12:25 AM
  2. 18T dowload to pc no eob just long string
    By karlbushnell in forum Fanuc
    Replies: 6
    Last Post: 01-28-2011, 02:55 PM
  3. String length
    By FGREF in forum SIEMENS > Sinumerik 802D/840D/810D/828D
    Replies: 1
    Last Post: 06-07-2010, 06:44 AM
  4. Zap String
    By Aplus in forum Bridgeport / Hardinge Mills
    Replies: 10
    Last Post: 11-04-2009, 05:01 AM
  5. String transfer to G-command
    By beno in forum SIEMENS -> GENERAL
    Replies: 3
    Last Post: 06-17-2009, 05:26 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •