سلام
در مثال بسکام دیدم زیاد از این دستور استفاده کرده ولی هیچی ازش نمی فهمم ،این دستور داره یک متغیر رو میخونه ولی چطور ؟
مثال بسکام
در مثال بسکام دیدم زیاد از این دستور استفاده کرده ولی هیچی ازش نمی فهمم ،این دستور داره یک متغیر رو میخونه ولی چطور ؟
مثال بسکام
کد:
[COLOR=#000080][FONT=Courier New][B]$regfile[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"m48def.dat"[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008000][FONT=Courier New]' specify the used micro[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]$crystal[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 4000000 [/FONT][COLOR=#008000][FONT=Courier New]' used crystal frequency[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]$baud[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 19200 [/FONT][COLOR=#008000][FONT=Courier New]' use baud rate[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]$hwstack[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 32 [/FONT][COLOR=#008000][FONT=Courier New]' default use 32 for the hardware stack[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]$swstack[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 10 [/FONT][COLOR=#008000][FONT=Courier New]' default use 10 for the SW stack[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]$framesize[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 40 [/FONT][COLOR=#008000][FONT=Courier New]' default use 40 for the frame space[/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] A [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Integer[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] B1 [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Byte[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Byte[/B][/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] S [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]String[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]*[/FONT][/COLOR][FONT=Courier New] 15[/FONT] [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] L [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Long[/B][/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta1 [/FONT][COLOR=#008000][FONT=Courier New]'point to stored data[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]For[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 1 [/FONT][COLOR=#000080][FONT=Courier New][B]To[/B][/FONT][/COLOR][FONT=Courier New] 3 [/FONT][COLOR=#008000][FONT=Courier New]'for number of data items[/FONT][/COLOR] [FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] B1 [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]" "[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] B1[/FONT] [COLOR=#000080][FONT=Courier New][B]Next[/B][/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta2 [/FONT][COLOR=#008000][FONT=Courier New]'point to stored data[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]For[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 1 [/FONT][COLOR=#000080][FONT=Courier New][B]To[/B][/FONT][/COLOR][FONT=Courier New] 2 [/FONT][COLOR=#008000][FONT=Courier New]'for number of data items[/FONT][/COLOR] [FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] A [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]" "[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] A[/FONT] [COLOR=#000080][FONT=Courier New][B]Next[/B][/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta3[/FONT] [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] S [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] S[/FONT] [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] S [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] S[/FONT] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta4[/FONT] [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] L [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] L [/FONT][COLOR=#008000][FONT=Courier New]'long type[/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'demonstration of readlabel[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] W [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] Iram [/FONT][COLOR=#000080][FONT=Courier New][B]Word[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]At[/B][/FONT][/COLOR][FONT=Courier New] 8 [/FONT][COLOR=#000080][FONT=Courier New][B]Overlay[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008000][FONT=Courier New]' location is used by restore pointer[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'note that W does not use any RAM it is an overlayed pointer to the data pointer[/FONT][/COLOR] [FONT=Courier New]W [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Loadlabel[/B][/FONT][/COLOR][COLOR=#ff0000][FONT=Courier New]([/FONT][/COLOR][FONT=Courier New]dta1[/FONT][COLOR=#ff0000][FONT=Courier New])[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008000][FONT=Courier New]' loadlabel expects the labelname[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] B1[/FONT] [COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] B1[/FONT] [COLOR=#000080][FONT=Courier New][B]End[/B][/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [FONT=Courier New]Dta1[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]&[/FONT][/COLOR][FONT=Courier New]B10 [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]&[/FONT][/COLOR][FONT=Courier New]HFF [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] 10[/FONT] [FONT=Courier New]Dta2[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] 1000[/FONT][COLOR=#ff0000][FONT=Courier New]%[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]-[/FONT][/COLOR][FONT=Courier New]1[/FONT][COLOR=#ff0000][FONT=Courier New]%[/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [FONT=Courier New]Dta3[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"Hello"[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"World"[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'Note that integer values (>255 or <0) must end with the %-sign[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'also note that the data type must match the variable type that is[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'used for the READ statement[/FONT][/COLOR] [COLOR=#000000][FONT=Arial] [/FONT][/COLOR] [FONT=Courier New]Dta4[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR] [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] 123456789[/FONT][COLOR=#ff0000][FONT=Courier New]&[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'Note that LONG values must end with the &-sign[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'Also note that the data type must match the variable type that is used[/FONT][/COLOR] [COLOR=#008000][FONT=Courier New]'for the READ statement[/FONT][/COLOR]
دیدگاه