Using several cogs
Could anyone give me a program where one makes use of several cogs. I'd like to better understand the use thereof.
I'm using the card propeller parallax. It is has a eight cogs.
Thanks already.
I'm using the card propeller parallax. It is has a eight cogs.
Thanks already.

Comments
Everywhere you look on the forum there is use of multiple cogs. Firstly, the most basic is to use a cog to send/receive to the pc. Next, you can add a VGA monitor (uses a couple of cogs depending on which VGA driver. TV can use 1 or more cogs. A keyboard will use 1 cog. Interfacing to an SD card will use 2 cogs - one for the low level SPI interface and 1 for the FAT implementation. Remember, our drivers take care of a lot of other things normally done in main code is other micros.
So, our FullDuplexSerial object that does serial does more than just perform a UART function, it actually takes care of everything so all you do is place characters into a buffer and take the received characters out of a buffer.
The of course, there is ZiCog which performs a whole Z80 & CPM emulation.
if you are refering to the prop demoboard (or other board with VGA connector) and find propforth on google code, an example that might be interesting is LowResVGA.f
The propforth kernel runs a user prompt on cog6, which communicates to the PC serial port via cog7. User input entered in the PC terminal propgram is processed interactively.
Cog3 and cog4 are have user prompts which are displayed on the VGA terminal connected directly to the propboard, and the user input is entered from the keyboard connected directly to the propboard.
The user can interact with the cogs at the same time, type input into one cog which and change stuff on the other cogs.
connect LEDs through resisters to pins 16-23
{{ AssemblyToggle.spin toggle leds on pins 8 pins using all 8 cogs }} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR long thePin PUB Main (loop) {Launch cog to toggle LED endlessly} repeat loop from 16 to 22 thePin := loop cognew(@Toggle, @thePin) 'Launch new cog waitcnt(clkfreq/2 + cnt) ' Pause thePin := 23 'set Pin for cog 0 coginit (0,@Toggle, @thePin) 'launch Toggle in cog 0 DAT {Toggle Pins on cogs} org 0 'Begin at Cog RAM addr 0 Toggle rdlong ScratchMem, par shl Pin, ScratchMem mov dira, Pin 'Set Pin to output mov ScratchMem, cnt 'Calculate delay time add ScratchMem, #9 'Set minimum delay here Increment waitcnt ScratchMem, Delay 'Wait add Delay, IncValue 'Increment Delay value max Delay, MaxDelay wc 'Set Maximum Delay xor outa, Pin 'Toggle Pin if_nc jmp #Decrement 'jump to Decrement loop jmp #Increment Decrement waitcnt ScratchMem, Delay 'Wait sub Delay, IncValue 'Increment Delay value min Delay, IncValue wc 'Set minimum Delay xor outa, Pin 'Toggle Pin if_c jmp #Increment 'jump to increment loop jmp #Decrement Pin long 1 'Pin variable Delay long 1_000_000 'Clock cycles to delay IncValue long 50_000 'increment value MaxDelay long 20_000_000 'maximum delay ScratchMem res 1 'System Counter Workspace