Shop OBEX P1 Docs P2 Docs Learn Events
Control Cog muticore and add ram — Parallax Forums

Control Cog muticore and add ram

mklrobomklrobo Posts: 420
edited 2014-11-13 09:05 in Propeller 1
:smile: Hello!
I would like to know if anyone has code to control which cog is called, and the ability to shut down individual cogs.
The manual indicated that this is done with IDs. Also, With the Board of Education, will I be able to use a SD card to
function with the Ram, or is it to store programs? The extra memory for the propeller would be a relief.
Thanks for your help..:nerd:

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2014-11-13 08:31
    Look in the Propeller Reference Manual in the sections on the COGINIT and COGSTOP instructions and their equivalent Spin statements. One of the parameters to COGINIT is the number of the cog to be used to run the new assembly program. Similarly, COGSTOP takes a parameter which is the number of the cog to stop.

    Any Propeller board with an SD card attached to it (via 4 I/O pins) can store programs on it. Data can also be stored on the card, but neither is automatic. You have to have some kind of program in the attached EEPROM that handles the SD card. C programs can be compiled in XMMC mode where code is "paged" in from the SD card on demand and the C library handles this. This slows down execution (significantly), but allows very large programs to be run. Data (variables) have to be stored in RAM. There's no way to automatically put variables on an SD card. That would slow down execution too much. There are some other boards (like the C3) that have external RAM that can be used for data (variable) storage using special XMM modes. This still slows down execution markedly, but is practical for some applications.
  • mklrobomklrobo Posts: 420
    edited 2014-11-13 08:40
    Mike Green wrote: »
    Look in the Propeller Reference Manual in the sections on the COGINIT and COGSTOP instructions and their equivalent Spin statements. One of the parameters to COGINIT is the number of the cog to be used to run the new assembly program. Similarly, COGSTOP takes a parameter which is the number of the cog to stop.

    Any Propeller board with an SD card attached to it (via 4 I/O pins) can store programs on it. Data can also be stored on the card, but neither is automatic. You have to have some kind of program in the attached EEPROM that handles the SD card. C programs can be compiled in XMMC mode where code is "paged" in from the SD card on demand and the C library handles this. This slows down execution (significantly), but allows very large programs to be run. Data (variables) have to be stored in RAM. There's no way to automatically put variables on an SD card. That would slow down execution too much. There are some other boards (like the C3) that have external RAM that can be used for data (variable) storage using special XMM modes. This still slows down execution markedly, but is practical for some applications.
    :lol: Thanks for the info! I assume that this can be done with SimpleIDE or the Spin compiler? Thanks again.:smile:
  • Mike GreenMike Green Posts: 23,101
    edited 2014-11-13 09:05
    There are functions available in SimpleIDE (cogstart and cogstop) that do the same things as Spin's COGSTART and COGSTOP. Note that COGSTART is preferred to COGINIT in most circumstances. COGSTART starts the new code in the first available idle cog and returns the number of the cog used which can be saved for later use with COGSTOP. There are very few circumstances where it's useful to use a specific cog.
Sign In or Register to comment.