To: sam_sam_sam
potatohead
Posts: 10,261
you sent me a PM, where I was going to basically reply to ask you to start a forum thread, so that everybody may benefit from the time spent.;
The code block you pasted from the PDF contained some formatting characters, I believe. I tried it using notepad first, before pasting into the Propeller tool. It worked out fine.
Here's my reply, and it appears you are set not to receive PM's! So, I'll just drop it here, and you can start a forum thread for the next PASM question.
'
Well, I pasted it from your code window into my Prop tool, and did not get this error. You probably copied and pasted from the PDF. Might want to use something like notepad to paste into, just to get rid of potential formatting characters that may be present in the PDF. It's good at first to type stuff in as well. Helps with overall memory of syntax, for what that's worth.
I don't think there was anything else wrong, but I did take a moment to format it for better reading.
I really would prefer not to do these via PM. It is much better to start a forum thread so that everyone gets the benefit of the time spent. No worries on this one though.
The code I pasted in compiles fine. I've not yet debugged it. You should run it and continue on where you are right now.
The code block you pasted from the PDF contained some formatting characters, I believe. I tried it using notepad first, before pasting into the Propeller tool. It worked out fine.
Here's my reply, and it appears you are set not to receive PM's! So, I'll just drop it here, and you can start a forum thread for the next PASM question.
'
Well, I pasted it from your code window into my Prop tool, and did not get this error. You probably copied and pasted from the PDF. Might want to use something like notepad to paste into, just to get rid of potential formatting characters that may be present in the PDF. It's good at first to type stuff in as well. Helps with overall memory of syntax, for what that's worth.
I don't think there was anything else wrong, but I did take a moment to format it for better reading.
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 PUB Main {Launch cog to toggle P16 endlessly} cognew(@Toggle, 0) 'Launch new cog cognew(@Toggle1, 0) 'Launch another new cog DAT {Toggle P16} Toggle mov dira, Pin 'Set Pin to output mov Time, cnt 'Calculate delay time add Time, #$f 'Set minimum delay here :loop waitcnt Time, Delay 'Wait xor outa, Pin 'Toggle Pin jmp #:loop 'Loop endlessly Pin long |< 16 'Pin number Delay long 600 'Clock cycles to delay Time res 1 'System Counter Workspace {Toggle P17 ---------------------------------------------------} ORG 0 'Begin at Cog RAM addr 0 Toggle1 mov dira, Pin 'Set Pin to output mov Time, cnt 'Calculate delay time add Time, #$f 'Set minimum delay here :loop waitcnt Time1, Delay1 'Wait xor outa, Pin1 'Toggle Pin jmp #:loop 'Loop endlessly Pin1 long |< 17 'Pin number Delay1 long 400 'Clock cycles to delay Time1 res 1 'System Counter WorkspaceFormatting is very important. It pays off to format stuff. Often you will see errors just when doing that. Technically, the code will work poorly formatted, but it's difficult to read and understand.
I really would prefer not to do these via PM. It is much better to start a forum thread so that everyone gets the benefit of the time spent. No worries on this one though.
The code I pasted in compiles fine. I've not yet debugged it. You should run it and continue on where you are right now.
sam_sam_sam wrote:In this post thttp://forums.parallax.com/attachment.php?attachmentid=48819&d=1187755108
in the assembly_09.pdf I have a question when you try to load this code you get this error
Invalid character in the given encoding. line 1 postion 2,
can you tell me what is wrong this code
ThanksCON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 PUB Main {Launch cog to toggle P16 endlessly} cognew(@Toggle, 0) 'Launch new cog cognew(@Toggle1, 0) 'Launch another new cog DAT {Toggle P16} Toggle mov dira, Pin 'Set Pin to output mov Time, cnt 'Calculate delay time add Time, #$f 'Set minimum delay here :loop waitcnt Time, Delay 'Wait xor outa, Pin 'Toggle Pin jmp #:loop 'Loop endlessly Pin long |< 16 'Pin number Delay long 600 'Clock cycles to delay Time res 1 'System Counter Workspace {Toggle P17 ---------------------------------------------------} ORG 0 'Begin at Cog RAM addr 0 Toggle1 mov dira, Pin 'Set Pin to output mov Time, cnt 'Calculate delay time add Time, #$f 'Set minimum delay here :loop waitcnt Time1, Delay1 'Wait xor outa, Pin1 'Toggle Pin jmp #:loop 'Loop endlessly Pin1 long |< 17 'Pin number Delay1 long 400 'Clock cycles to delay Time1 res 1 'System Counter Workspace