mb 4.0 beta, doesn't compile this project!

Beta Testing discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
ervius
Posts: 32
Joined: 23 Jun 2010 19:18

mb 4.0 beta, doesn't compile this project!

#1 Post by ervius » 05 Aug 2010 11:17

Hi all, I tryed the beta4 on my little X10 project,
here:

with 16f84A
at 12.000000Mhz xtal,
and in my case doesn't compile the project,
Mb beta runs on a windows 7 32 bit (I launch it without Administrator permissions!)

Code: Select all

program x10_out_test

dim House as byte
dim Unit as byte
dim unitcode as byte

dim outpin as sbit at portb.2
dim zeropin as sbit at portb.1
dim oldstate as bit

sub procedure SetInput(dim byref port as byte,  dim   pin as byte)
   dim  TRISptr as ^byte

    #IFDEF P16 then
       TRISptr=@Port +$80
    #ENDIF
    #IFDEF P18
       TRISptr=@Port+$12
    #ENDIF
    port.pin=0
    TRISptr^.pin=1
end sub

sub procedure SetOutput(dim byref port as byte, dim   pin as byte)
      dim  TRISptr as ^byte
    #IFDEF P16 then
           TRISptr=@Port +$80
    #ENDIF
    #IFDEF P18
           TRISptr=@Port+$12
    #ENDIF
    port.pin=0
    TRISptr^.pin=0
end sub


sub procedure x10_out(dim housetemp as byte, dim unittemp as byte, dim unitcommandtemp as byte)

    dim temp1 as byte[12]
    dim temp2 as byte[10]
    temp3 as byte[6]

    dim a,c as byte
    dim x as byte
    dim y as byte
    

  setoutput(portb,2)
  setinput(portb,1)



    temp1[0]=1
    temp1[1]=1
    temp1[2]=1
    temp1[3]=0

    temp3[0]=0
    temp3[1]=0
    temp3[2]=0
    temp3[3]=0
    temp3[4]=0
    temp3[5]=0

a=0
    for x=4 to 11 step 2
        if housetemp.a=1 then
           temp1[x]=1
           temp1[x+1]=0
        else
            temp1[x]=0
            temp1[x+1]=1
        end if
        a=a+1
    next x


for y=1 to 2
x=0
select case y
case 1
a=0
    for x=0 to 8 step 2
        if unittemp.a=1 then
           temp2[x]=1
           temp2[x+1]=0
        else
            temp2[x]=0
            temp2[x+1]=1
        end if
        a=a+1
    next x
case 2
a=0
    for x=0 to 8 step 2
        if unitcommandtemp.a=1 then
             temp2[x]=1
           temp2[x+1]=0
        else
            temp2[x]=0
            temp2[x+1]=1
        end if
        a=a+1
    next x
end select



    x=0
    oldstate=0
    while  zeropin=0
       nop
    wend

    while x<50
       oldstate=zeropin
       while oldstate=zeropin
          nop
       wend
       if x<22 then
          c=x
       else
          c=x-22
       end if

       if c<12 then
          a=temp1[c]
       else
          if c<22 then
             a=temp2[c-12]
          else
             a=temp3[c-22]
          end if
       end if

       if a=1 then
          a=0
          while a<125
          nop
          nop
          nop
          nop
              setbit(portb,2)
              delay_us(3)
              nop
              nop
              clearbit(portb,2)
              '''delay_us(3)
              inc(a)
          wend
       else
         'out_port^.out_pin=0
          delay_ms(2)
          'out_port^.out_pin=0
       end if
       x=x+1
    wend
next y
end sub

main:
trisb.7=1
portb=0

'inizialyze x10 protocol
'portb.2=output signals,portb.1=zerocross detect on powerline
'''x10_out_init()
delay_ms(1000)

portb.0=1
house=%0100
Unit = %11110
unitcode=%00101


while true
'if button on portb.7=1......
   if portb.7=0 then
      'send x10 command, under x10 protocol details,
      'send twice:header(1110)+housecode+unit+000000
      '+
      'send twice:header(1110)+house+unitcode+000000
       x10_out(house,unit,unitcode)
       delay_ms(100)
   end if
wend

end.
and doesn't compile, mikrobasic stucks at.:
0 1 mBPic.exe -DBG -pP16F84A -MSF -Y -DL -O11111114 -fo12 -N"C:\Program Files\Mikroelektronika\..............

and after a while, when I close application, "error popup" appear to decide to:
continue or close application ecc....

ervius
Posts: 32
Joined: 23 Jun 2010 19:18

Re: mb 4.0 beta, doesn't compile this project!

#2 Post by ervius » 05 Aug 2010 13:44

but if I execute it with "administrator privileges", all works well.....

mlebel
Posts: 58
Joined: 13 Apr 2010 11:55
Location: Karmiel, ISRAEL
Contact:

Re: mb 4.0 beta, doesn't compile this project!

#3 Post by mlebel » 11 Sep 2011 11:11

Interested in Smart Home modules?

Try: http://www.onofftech.com

It all been programed with MikroC

Post Reply

Return to “mikroBasic PRO for PIC Beta Testing”