First off, I am a NOOB regarding Python. But I don’t think that what I want to do should be too hard and I am an intermediate programmer in general. That being said here is what I am working on…
I have a small PIC processor that spits out debug bytes real time at 500kbaud. The bytes are location markers in the code on the PIC, and sometimes have a 1 or 2 byte payload, but usually not. I’ve used this for debugging for quite a while so I can debug while the chip is running real time. I have always used the Logic to watch and translate the serial line to decimal, then I would manually go to the table that translates the numbers into human readable labels to see what was going on.
I would like to write an extension to do the translation for me instead. I went through the Async example. I want to bring in decimal data instead of ASCII. Then I figure I can use a tuple table of my labels to print out what they mean. Once I get that down I can decide what to do with the bytes that have payloads.
So, I may have several questions, but my first is: In the example it was bringing in data with:
ch = frame.data[‘data’].decode(‘ascii’)
What is the frame.data when it comes in? If the analyzer is set to decimal can I just use the frame.data directly? Like:
debug_code = frame.data[‘data’]
Then I could output:
#Shortened List for the example
DebugMessageList = ( # This is actually a tuple, not a list, but who knows what a tuple is?
“UnUsed”,
“Initialize_Variables”, # 1
“Version_Load”, # 2
“Begin_BT_Setup”) # 3
…
result_types = {
'format':'{{DebugMessageList[debug_code]}}'
I know this is dumbed down, but is this headed the right direction? I am trying not to write a book here!