Full duplex buffer question
Zap-o
Posts: 452
Has anyone ever modified the full duplex object to hold the received data in a buffer? Then when I want, I can go into that buffer and read all of it.
Comments
What do you want to do with the buffer?
I also have a verson that holds the buffer (160 bytes each) in cog.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Well I am having problems running the FullDuplexSerial object and I end up missing some strings of data sent to it from a computer program. For example I have 2 cogs running, one the FullDuplexSerial and the "main cog" running all kinds of tasks. The "main cog" also packs the bytes into an array where the data can be compared as a command to execute by other cogs. When the computer program sends a series of strings (19200 baud) I end up missing the last 2 to 3. These strings contain roughly 9 - 20 bytes each.
So I wanted to create a buffer that could hold an array of bytes that my main cog could look at when its ready. This way I wont loose any commands. I hope this makes since...
@Cluso99
How do I get the buffer bytes?
Wish I knew machine code I could fix this issue...
With some strings up to 20 bytes long, you could lose the tail end of the string if your program isn't fast enough in emptying the receive buffer when it's only 16 bytes long.
·
Just edit it and change the CON sizes of the buffers to what you want 16/32/64/128/256/512 and the following line for the use with the AND $xx instruction. You do not need anything else to use it in place of the real FullDuplexSerial. (My version takes the fixed coded buffer length and places it as a constant). There are a couple of minor additions which won't do any harm.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
So should I run a loop that reads the buffer? How do I run the loop?
This is kind of what I am thinking.
obj
coms :"FullDuplexSerial_rr004"
Main
IF coms.rxcheck > $00
'Repeat until buffer == 0 not sure how to go about this?
'pack my byte array here
repeat while coms.rxcheck == 0
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
First off, increase the size of the receive buffers
Now add/modify a flush method which will reset the buffer so it's ready to receive.
Then you need to be able to find the buffer as a string.
And don't forget that you may simply need to know what the last character received was without upsetting the buffer. This way you can look for a terminator.
All this assumes that you don't overflow the buffer with your input (shouldn't) and that you run rx_flush to prepare the buffer.
In your main method you can do this
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Post Edited (Peter Jakacki) : 2/20/2010 6:21:53 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
I didn't see these methods in FDX as you said. The flush is there but it does not reset the read indices though. I do have my own extensive and comprehensive serial coms routines (unicom) which I am getting around to releasing into the obex but the object of the exercise was to show how to access the buffers directly. I have just checked the latest version of FDX and it didn't do this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
What is the IIRC?
BTW (By the way) I have posted my modified FullDuplexSerial on OBEX
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
T o n y