Shop OBEX P1 Docs P2 Docs Learn Events
Using the counters with simple ide - Page 2 — Parallax Forums

Using the counters with simple ide

2»

Comments

  • @iseries
    Tried again with your code got errors. Declared the ctra etc as int's earlier in the code and eliminated some errors. But
    got errors further down in your code. Commented as you can see some lines out hoping just to get the output on the O scope but got nothing.
    Confused.
    Thanks
    Martin

  • iseriesiseries Posts: 1,495

    The registers and counters are built into the compiler.

    They are defined in the COG.h include file that can be found here:"C:\Program Files (x86)\SimpleIDE\propeller-gcc\propeller-elf\include"

    If you are unable to get there then that's why your compiler doesn't work.

    As far as RDP or Remote Desktop Client.
    "On your local Windows PC: In the search box on the taskbar, type Remote Desktop Connection, and then select Remote Desktop Connection. In Remote Desktop Connection, type the name of the PC you want to connect to, and then select Connect."

    Mike

  • ersmithersmith Posts: 6,068

    Incidentally, Mike's original test program (Test360.c) compiles without any changes needed in FlexProp.

    It looks like you added declarations like int ctra to the code. These are wrong. If you want to access the actual hardware registers then you have to use the defines in "propeller.h" (included by "simpletools.h") which name the registers CTRA, FREQA, and so on. Note that these are upper case -- C is a case sensitive language!

  • @ersmith

    I am trying to get this to work in simpleide. Unless I used the declarions of int ctra, etc I get the error of undeclared.
    I am using the AN001 doc about counters page 4 of 19 and port it over to simple ide.
    Whoever wrote simple ide did not give one a library that gives one complete control of the counters. Only just a couple of canned uses. Declaring
    propeller.h still gives me errors "undeclared(first use in this function) which to my understanding should not happen.
    If I declare the int ctra, etc the error goes away but nothing on my scope.
    As we speak I ran Mike's code again on the flexprop gui. Had to fiddle with the pins. Even though it says pin ) it actually worked on Pin 1.
    Tried to run on simple ide with the added propeller.h and got the ctra errors of first declaration. Adding the declarations rids the errors and is case sensitive but nothing on
    any pin. This has simple tools and propeller .h both declared.

  • iseriesiseries Posts: 1,495

    Did you look at the COG.h file which has the definitions for the registers. If you put that file or those definitions in the code it should compile.

    I think there is a security problem that is preventing that file from being used.

    Mike

  • ersmithersmith Posts: 6,068

    @pilot0315 As I mentioned, C is a case sensitive language. ctra, Ctra, and CTRA are all different identifiers in C. If you copy C code from someone else, you must use the exact same names as they do. That is why you are getting errors in simpleide -- you tried to use ctra when the register name is really CTRA (all in capital letters).

  • @iseries
    Well I got test360 working in flexprop.
    Works on pin2 instead of pin3.
    Thanks and am studying the code.
    Still got issues with simpleide. Trying to write a simple counter program as in the AN001 square wave. I included simple tools.h, propeller.h and cog.h blank screen is the result on the scope and tried other pins on the board just in case and changed the 0 to a few other pins. Blank O'scope screen of death.
    Reminds me of microsoft crashing.
    Again I would like to get a programming working so I can access the counters and write a library for simple ide for more control.
    Moving back to my P2 lessons while I think about this issue.
    Thanks for the help.
    Martin

    c
    c
  • ersmithersmith Posts: 6,068

    @pilot0315 Do not re-declare the registers like FRQA. They are defined in propeller.h (or some file included therefrom). If you redefine them as just plain variables then they will no longer control the hardware registers.

    When you're having trouble, always always go back to a working program (like Mike's) and see what you've changed. One of your changes is most likely the problem.

Sign In or Register to comment.