All PC Control Tools Blog Posts

Welcome to the PC Control Tools blogs. We post a wealth of information in our blogs. Come here to find things like the latest company news, useful programming tips, code samples, and videos.


  • PC Controls to Attend MIX2010 Conference

    I am planning to attend the MIX2010 Conference again this year in Las Vegas, March 15-17. I attended last year as well and it was a useful and interesting experience.

    The conference has an interesting "MIX" of developers and designers. Although PC Controls and myself are more focussed on the development side, it seems you are always involved in the user interface and design at some level.

    I have heard other Minnesota techies / developers who are attending include Scott Davis, Jeff Brand, and Mike Benkovish. I would enjoy meeting and networking with any other Minneapolis / Twin Cities developers who may attend as well. Please contact me and let's get meet up at the conference.

    Full story

    Comments (12)

  • Configuring Multiple PLC Runtimes in TwinCAT

    The TwinCAT system allows you to run up to 4 PLC runtimes on 1 PC based controller. This is a very useful feature, for example, I have used this during development by implementing a separate PLC Simulator program that runs on its own run-time.

    Variables from the second Simulator PLC project can be linked to the first, machine PLC project to act as inputs/outputs during development.

    Adding a Second TwinCAT PLC Runtime

    Right click on PLC configuration to add another PLC runtime. Up to 4 PLC run-times can be configured.

    Append a second PLC runtime by right clicking on the TwinCAT PLC Configuration node.

    Runtime system is used by another project!

    However, when setting up a second runtime for the first time, you might get the above error, which can be frustrating. Below are the steps to setup multiple run-times in the TwinCAT System Manager and PLC Control.

    The runtime in use error occurs when you try to add a second PLC project, but have not enabled multiple runtimes, or chosen the second runtime in the PLC editor.

    Choose Number of Runtimes and Apply

    Choose the number of runtimes on the PLC settings tab. After making the selection, you must hit Apply, then save the System Manager file and Activate the configuration.

    Enable additional TwinCAT PLC runtimes on the PLC Settings tab. Hit the Apply button to activate the setting.

    Choose Runtime System in TwinCAT PLC

    From ...

    Full story

    Comments (719)

  • Export from SQL Server to SQL Server Compact

    It is not possible to use the import / export wizard to easily move data from SQL Server 2005/2008 to SQL Server Compact.

    However, I found an example of a stored procedure from this article Generating INSERT statements in SQL Server by Sumit Amar on CodeProject. The procedure can be used to generate insert statements for each row in a table. You can then apply these insert statements to a SQL Compact database using SQL Server Management Studio.

    I modified the procedure to add a semicolon at the beginning, so you can run multiple statements from a SQL Management Studio window.

    I have used this method to easily create data within a SQL Compact database. I have used it for tables with up to around 100,000 rows, but much more than that, and it would take a long time to cut/paste and run the statements. .

    Create InsertGenerator Stored Procedure

    CREATE PROCEDURE [dbo].[InsertGenerator] 
    	@tableName as varchar(100)
    AS
    BEGIN
    
    	--Declare a cursor to retrieve column specific information 
    	--for the specified table
    	DECLARE cursCol CURSOR FAST_FORWARD FOR 
    	SELECT column_name,data_type FROM information_schema.columns 
    		WHERE table_name ...

    Full story

    Comments (15)

  • Connecting Visual Studio to Beckhoff Windows CE Devices

    You can quickly develop .NET applications in Visual Studio that target Beckhoff Windows CE controllers. At some point, it always becomes essential to connect to the device from Visual Studio, and debug the application online, running on the device hardware and not just an emulator.

    After pressing F5 to deploy the application, it will prompt you to choose a device. The Windows CE Device is the correct choice, but unless connection options are set correctly, you will only get the dreaded error "Unable to connect to device".  

    Before reading the rest of this post, refer to the MSDN article below.

    How to: Connect to Windows CE Device Without ActiveSync

    Below are the steps to connect to a Beckhoff device.

     

    Step 1. Copy the Windows CE Debug Files to the Device

    There are five files you need to copy to the Windows CE controller. The most important is ConmanClient2.exe. Executing this file on the device enables the device to listen for an incoming connection from Visual Studio.

    Clientshutdown.exe
    ConmanClient2.exe
    CMaccept.exe
    eDbgTL.dll
    TcpConnectionA.dll

    These files ...

    Full story

    Comments (896)

  • TwinCAT NCI Running but Axes do not Move

    It is very easy to create a 3 axis CNC system and run CNC commands and programs in simulation mode with TwinCAT NCI. Simply add 3 simulation axes X, Y, and Z to the NC taxk as shown in the configuration below. Then, add a NCI Channel to the task, save, and activate the configuration. After the system starts, goes green, and is running, assign the three axes to the NCI channel group and then enable each axis on its respective Online tab.

    You may now think that it is configured and ready to go, especially if you are experienced with TwinCAT PTP. You go to the channel MDI tab to try entering CNC commands. However, there is a critical step that has been overlooked, and missing this step can be frustrating and time consuming.

    The program appears to be running, yet there is no error in the logger console at the bottom of the TwinCAT window. Even more confusing, the 3 axes do not move and remain at zero, even though the channel status clearly states ...

    Full story

    Comments (17)

  • The Schtick Beckhoff Inverse Pendulum Control

    Below is a very cool video demonstrating the type of control that can be accomplished with a Beckhoff Automation control system. It balances in inverse pendulum using a 500 microsecond control loop on a Windows Embedded PC based controller. This video is shown as part of the Microsoft IT Showcase.

    Become a fan of the Microsoft IT Showcase on Facebook.


    Hard Real-Time Demo: Hannover Messe

    Full story

    Comments (1039)

  • The Best TwinCAT PLC Font

    When I was an early software programmer, I never changed any of the default options and fonts in the TwinCAT PLC Editor. If you work with the editor for long periods of time, however, you will soon find that it is very useful to use a very legible font. In addition, I have found that the use of a monotype font, where all characters are equal in length, is essential for efficiently developing code.

    Default TwinCAT PLC Font

    The default font in the TwinCAT PLC development environment is MS Sans Serif 10pt as shown below. This is a pretty legible font, but is not the best chioce for the structured text language.

    TwinCAT PLC development environment using the default MS Sans Serif font

     

    Changing the Font to Lucida Console

    Beckhoff colleague advised me that this default choice is not ideal, because it is hard to see the semicolons at the end of the structured text programming language. His advice was to use the Lucida Console Font. Below is an example using 8pt. Bold. You can change the font by using the ...

    Full story

    Comments (15)

  • Website Search Issues Fixed

    There were some major issues with the search box we use in the upper right corner of pages on this site. The Sitefinity CMS we use on this site has built in search and indexing capabilities, however we had it configured poorly.

    We have corrected an that was preventing the Enter key from firing the search.

    We have corrected a Javascript issue that was causing the text to disappear, and preventing the search text from being applied.

    We have enabled auto-indexing on the site's search indexes, so now content will be indexed nearly instantly when new articles and content is added.

    Sorry for any frustration or inconvenience. Happy searching!  

    Full story

    Comments (12)

  • Installing SQL Server CE Compact Edition

    SQL Server Compact Edition (SQL Server CE) is a lightweight, yet powerful member of the SQL Server 2008 family. It can be installed on either a Windows Mobile device or on a full, desktop operating system.

    For example, a common use of SQL Server CE is to store data locally on a handheld device. This is often used in data collection and inspection systems when the device is only intermittently connected to a network, or synced regularly at the end of the day. However, it is not just mobile applications that can benefit from SQL Server CE, it can be implemented on notebooks and tablets, running full blown Vista, for richer versions of client software.

    Beckhoff Embedded PC Controllers running Windows CE or Embedded can use SQL Server CE as a local data store.

    Steps:

    Step 1. Install the correct / latest .CAB installation file.

    For more information about SQL Server Compact Edition:
    http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx

    At the time of this article the latest version is 3.5 SP1. Follow the links to the download page for this component. You will ...

    Full story

    Comments (9)

  • TwinCAT Blue Screen 64 Bit AMD Processor

    I shamelessly copied this scenario and solution from the TwinCAT Developer LinkedIn group. Kudos to Steve Maves of Beckhoff Automation USA support, who fixed a customer's bluescreen issue by making the registry tweak below.

    I have had a Dell laptop on a project recently that blue screens every time I try to start the TwinCAT System. I am not sure if this is the same problem that is described below, but I am going to try this tweak the next time I have access to the laptop.

    I will update this post when I determine if this fixed my problem as well. 

    The Blue Screen Problem

    Numerous blue screens of death (BSOD) are occuring on a development computer.

    STOP: 0x0000008E (0xC0000005, 0xDE04BCA5, 0xECDEAA70, 0x00000000)
    TcRunTime.sys-adress ED04BCA5 base at ED037000, DateStamp 48e34ca8

    The PC System Properties

    AMD Athlon 64 Bit,1.5 GHz, 512 MB, Gigabyte motherboard (GA-K8VT800 Pro) with XP pro SP2

    The Registry Tweak Solution

    Changing the registry key

    HKEY_LOCAL_MACHINE\SOFTWARE\BECKHOFF\TWINCAT\SYSTEM KEY
    ‘DisableC1E’ to value ‘0’

    According to Steve: "This regkey disables TwinCAT from using a feature which is ...

    Full story

    Comments (22)

  • Beckhoff CX1000 CX1001 CX1010 CX1020 CX1030 Images

    You may often need to restore a backup image to a CX controller, or be able quickly deploy a solid, tested image to multiple controllers. Here are some points and links to consider when planning a CX controller deployment. Note, that this article only applies to x86 based CX controllers, that have a removable CF card. This does not apply to embedded CX9000 series controllers. For those devices, browse to the links shown in the references at the end of this post for more information.

    This posting is subject to change, please note the references at the end and search for more information in the Beckhoff Information System and Beckhoff FTP Server.

    1. Make Initial Backup Copy of the Compact Flash Card

    When you get your new CX controller, my advice would be to immediately make a copy of the complete compact flash (CF) card, so you have a default image to fall back on in case things go wrong during development. You can make a backup of the CF very easily by plugging a standard ...

    Full story

    Comments (12)

  • Bechoff FTP Server Resources

    Beckhoff has many resources to assist in developing applications on their embedded controllers.

    One of these lesser known, but extremely useful places is the Bedkhoff FTP Server: ftp://ftp.beckhoff.com

    For example, a cache of extremely useful Windows CE Embedded tools and solutions can be found in this sub-directory location.

    ftp://ftp.beckhoff.com/Software/embPC-Control/CE/Solutions

    Browsing Beckhoff FTP Server wtih Windows Explorer

    You can use either windows explorer or Internet explorer to easily browse FTP servers.

    Beckhoff FTP Server Windows Explorer

    Browsing Beckhoff FTP Server with Filezilla

    I particularly like to use Filezilla's FTP client to browse resources like this. You can simply click on the link, or use Windows Explorer, but it is much more efficient to browse and download with a rich client.

     Beckhoff FTP Server Filezilla

     

    Full story

    Comments (14)

  • Technocrati Blog Code

    ew68cjstnp

    Full story

    Comments (9)

  • Minnesota Developers Conference 2009

    I received news today about the Minnesota Developers Conference. I have not attended this event in the past, but am planning on doing it this year. It looks like an interesting, valuable, and fun event for developers. I have heard Mike Benkovich and Scott Davis speak at events in the past, and look forward to hearing more on their topics.

    Date: September 30, 2009 

    Price: $150 per attendee.

    Location: McNamara Alumni Center, University of Minnesota 200 Oak St. SE, Minneapolis, MN 55455

    Full story

    Comments (8)

  • CX1000 Factory Reset

    It is possible to do many very useful administrative tasks, including a factory reset of a Beckhoff embedded controller (CX1000, CX9000, CX1020 series) using the Web Administration Interface that is built into the embedded device's image.

    This is a documented feature within the Beckhoff Information System, but a search for this topic proved quite difficult and time consuming. Hopefully putting this information here will save others the headache.

    Note, the documentation says that this interface is only available on "CE based devices (image 2.16 or higher required)"

    CX Web Administration Portal Documentation

    You can drill down the left had tree and find help on this topic. There are a lot of other interesting tips and tricks at this path as well.

    Infosystem Path to the Web Based Controller Administration Topic

    Embedded PC > Operatingsystem > CE > Web based diagnostic and configuration interface

    Accessing the TcWebAccess Web Administration Portal

    Open a browser and type in the url path below, using to the controller's name or IP address. The browser should connect to the device's ...

    Full story

    Comments (54)

  • TwinCAT NCI 3 Axis CNC Simulation Video

    TwinCAT NCI is a PC based CNC controller, where you can group axes into a channel, and command them using standard G-Codes and part programs. It is very easy to quickly setup a 3 axes simulation in TwinCAT NCI for development and to demonstrate how to run programs.

    You need to download the trial version of TwinCAT and install it at the NCI level. During installation, there is a dialog with a choice to install TwinCAT at the PLC, NC PTP, or NCI level. It must be installed at the highest, NCI level to have access to the NCI tasks and services shown in the video below.

    The video above shows these steps to create a configuration and run programs.

    1. Download and install TwinCAT at the NCI level
    2. Open System Manager and add 3 axes, which will be simulation axes by default
    3. Add an NCI channel that will be used to group the axes into a channel
    4. Activate the configuration
    5. Assign the axes to the channel
    6. Enable the 3 axes
    7. Set the channel override to 100%
    8. Start entering ...

    Full story

    Comments (15)

  • Moving a Window back On Screen

    Recently I had a problem in a demonstration to a customer where the window I wanted to show was off the screen. This is because I use two monitors on my docked workstation, but when I remove the laptop to use it remotely, sometime strange things like this occur. It extremely frustrating to have this happen in front of a group, and unless you've practiced these steps, there is nothing you can do to fix it quickly.

    I found this solution a while back, using shortcut keys, and decided to post it here.

    1. Select the program window you're trying to move, using ALT-TAB or by starting Task Manager.

    2. Press ALT+SPACEBAR on your keyboard, which brings up the program's shortcut menu. You can't see this, since the window is off screen. It may help to practice the procedure on a window you can see.

    3. Arrow down once, and hit Enter to activate the Move menu item.

    4. Use your LEFT ARROW, RIGHT ARROW, UP ARROW, or DOWN ARROW keys to move the window so you can see its title bar ...

    Full story

    Comments (7)

  • Beckhoff Infosys Search Tips

    I regularly search the online Beckhoff Information System, (infosys.beckhoff.com) for information and programming examples.

    Tip 1. Use a mouse click, not the Enter key to initiate a search

    This may be obvious, and is more of an just an annoyance, but it was frustrating to me that the first couple times I searched that I was getting no results back. This is because the search form was not picking up the Enter key press.

    After typing in a search query into the search box on the site, you must use the mouse to click the "Search" or "Suchen" button on the site. Simply hitting the enter key does not activate this search button, and it will appear that you get no results.  

    Tip 2. Use Google to search only the Infosys domain

    Sometimes, I like to use google to search a domain instead of using the site's internal search engine. I do not know how Beckhoff ranks the results in their Infosys search, so as a fall back, I rely on google if I am ...

    Full story

    Comments (11)

  • Table Width Issues in Firefox

    Background

    I was asked recently by a customer to help correct some strange layout behavior that they were seeing in their website application using the Apple Safari browser. The client had been diligently building and testing their application using IE and Firefox, however a new user wanted to use Safari as well. When opening the site in Safari, one of the main div containers looked ghastly, and was pushed up and over the other two main containers that they had on the page. This behavior only occurred in Safari, not in IE or Firefox.

    After some investigation of the source and stylesheet, the culprit was a stray position:relative css setting in the stylesheet. The other two browsers seemed to make different assumptions about how to display the page, and it looked fine, since even with the relative position setting. Because there was no top or left position properties set, the setting appeared to be ignored by these browsers.

    So, now Safari looked great, but after refreshing the site in Firefox, now one of the containers ...

    Full story

    Comments (17)

  • TwinCAT PLC Variable is too Large Error

    Recently, I was working on a PLC program and ran into this error message. I had created several data structures, and marked them with wildcard output addresses as shown below:

    stInProductStack AT %Q*: ARRAY [1..1200] OF ST_InProductRecord;

    However, I received an error in the message window when trying to build the PLC project:

    Error 3801 Data(10): The variable 'stInProductStack' is too large (24000 bytes)

    This did not make sense to me at first. I was trying to use this data structure to store data persistently in the CX1000 NOV-RAM, which has memory space for 128 KB  of data, so why should it get an error like this? The variable stInProductStack was only 24 KB?

    Well, it turns out the error can be easily be resolved in the Options .> TwinCAT PLC menu items screen. I just increased the size from the default setting of 16 KB to 128 KB for both input and output data as shown below.

    TwinCAT PLC Options

    I am not really sure why the default setting is 16 KB, or if there is any performance impact related to increasing ...

    Full story

    Comments (15)

  • Useful Free Programming Utilities

    I was cleaning up my computer, and decided to take an inventory of some of the more useful free programs that I have installed.

    I built up a list by inspecting these areas:

    1. Remove Programs List
    2. Program Files folder
    3. Startup Menu Folder
    4. Registry Startup Keys

    It seems we need an ever increasing array of tools to build software effeciently. My list of programs has grown to what seems like an alarming number. However, I believe this is just a way of life for PC based development. Ever more powerful computers are coming out, and IDE's are constantly evolving into more massive installations. It seems the release of new, faster, less expensive, and even free applications will never slow.

    Here's a short list of some of the most useful free applications I've installed: Some are pretty obvious, but I include them all regardless. There will come a day when I get a new PC or need to rebuild my OS, and I would like to come back here to remind me of some of my favorite free tools. ...

    Full story

    Comments (748)