سلام مهندس
بعضی وقت ها نوشتن مجدد برنامه از تحلیل و ویرایش برنامه از پیش نوشته راحت تر و سریع تره..!!!:0013:
شما بگو میخای چیکار کنی ؟؟؟
این برنامه برای سگمنت 3تایی هست...!
منظور شما رو دقیقا متوجه نشدم ... میخواهید تنها یک رقم رو نمایش بدید یا چیز دیگه ایست قضیه ..!!!
برای نمایش کد ها هم میتونی گزینه code استفاده کنی :wink:
به این صورت :
کد:
$regfile = "m8def.dat"
$crystal = 1000000
config adc = single , prescaler = auto
config pinc.5 = input
config portb = output : Portb = 0
config pinc.0 = output : S1 alias portc.0 : Set s1
config pinc.1 = output : S2 alias portc.1 : Set s2
config pinc.2 = output : S3 alias portc.2 : Set s3
dim a as word
dim aa as word
dim i as byte
dim t as word : T = 1
dim w as single
declare sub show(byval a as word)
do
start adc
a = getadc(5)
stop adc
if a < 205 then
a = 0
else
a = a - 205
w = a / 2.72
a = w
end if
call show(a)
loop
end
'******************************* show
sub show(a as word)
do
incr i
aa = a mod 10
select case i
case 1:
portb = lookup(aa , annode_display)
set s1 : Waitms t
case 2:
portb = lookup(aa , annode_display)
set s2 : Waitms t
case 3:
portb = lookup(aa , annode_display)
set s3 : Waitms t
end select
reset s1 : Reset s2 : Reset s3
a = a \ 10 : If a = 0 then exit do
loop
i = 0
reset s1 : Reset s2 : Reset s3
end sub