Receiving incorrect data through Serial
I'm trying to interact with UART using assembly, but I can't seem to get it to print the right data.
the main things to look at are
putc
and puts
. everything works fine only if I used one of them and not both in one program.5 Replies
Pastebin
.include "m328pdef.inc" .include "delay.inc" .cseg .or...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Looks like this is going to blow up your stack as you wait.
Every time you wait here, you're going back to
putc
and re-pushing r17
to the stack
would also make sense why you're only getting issues when you try to use both putc
AND puts
; I assume puts
calls putc
my suggestion would be this
note though that I haven't checked your code very far; this was the first thing that stuck out to me so idk if this is the root of the issue @wtf
so just checked for clarification; you're NOT using putc
to help implement puts
for some reason; I'd suggest using the putc
that's in puts
to re-make putc
, then have puts
call putc
seems that puts
's character printing is at least somewhat working for printing Hello
that's so obvious idk how I didn't catch that
I'll give it a shot
works
there goes 1 day of debugging to a dumb mistake
This is why things are typically broken down into parts like this; the whole point of making
putc
is so you only have to debug "print a single character to serial" once, then you write "print a string" in terms of "print a single character" and loops/conditionals
I'd strongly suggest making your puts
call putc
so you don't have two separate snippets of code that print to serial (that's 2x the places for you to make such a hard to spot mistake)that's what I did. will keep that in mind for the future