whats special about W6?

jinx

Senior Member
hi, I,ve just finished an 18m2 ir/touch board for the "DUCK" while programming if i used w6 anywhere it would just keep transmitting the value 70 which i assigned to a touch value
Code:
#picaxe18m2




symbol toduck   = c.6
symbol fromduck = c.7
symbol cmnd     = b0
symbol junk     = b1


symbol    lts  = b.7
symbol    rts  = b.6
symbol    lmts = b.5
symbol    rmts = b.4





init: pause 100
      gosub setTsens
      pause 100
main:
     
 do
  
  irin [100],c.2, infra
 
  select case infra
   
       case 1
        let cmnd = 10
         gosub senddata
         
       case 2
        let cmnd = 20
         gosub senddata
        
       case 3
        let cmnd = 30
         gosub senddata
         
       case 4  
        let cmnd= 40
         gosub senddata
        
       case 5
        let cmnd = 50
         gosub senddata
         
       case 6
        let cmnd = 60
         gosub senddata
         
         
       
   
  end select
   let infra = 0 
  
   
    touch16 rts,w5
     if w5 > w1 then 
       
       let cmnd = 70
       gosub senddata
       pause  10 
       

    
          
      endif
      
      
   
   let cmnd = 0
   
   
  loop
  
  
   senddata:
            
               pause 10
         sertxd("cmnd is ",# cmnd,13,10)
            
     	high toduck										' tell MP that data is available
	pulsin fromduck,1, junk				                         ' junk is junk; we're just waiting
	low toduck										' prepare to send data
	
	serout toduck,N2400_4,(cmnd) 
	pause 10
	return
         let cmnd = 0
        
               return
        
        
           
   
 
  
  
 
 
 
 
 setTsens:
         
         touch16 b.6,w1                         'set top right sensor
          let w1 = w1 + 150
           pause 10
          
                  return
So this is a cut down version of the code where i got W1 in " the setTsens: " but if was W6 it would keep transmitting to the master PICAXE so i was just wondering if W6 is a reserved word.
 

Jamster

Senior Member
Not that I'm aware of...

Whats your whole code?
Are you sure nothing's interfering with the value from the touch input, try swaping it for a different variable.

Jamster
 

hippy

Ex-Staff (retired)
The 'infra' variable is an alias for 'b13' on the 18M2, and as 'b13' is a part of 'w6' it is affecting that.
 

jinx

Senior Member
here the whole code i did'nt miss that much out from post 1
Code:
#picaxe18m2




symbol toduck   = c.6
symbol fromduck = c.7
symbol cmnd     = b0
symbol junk     = b1


symbol    lts  = b.7
symbol    rts  = b.6
symbol    lmts = b.5
symbol    rmts = b.4





init: pause 10
      gosub setTsens
      pause 10
main:
   high b.0
   low  b.3

   
 do
  
  irin [100],c.2, infra
 
  select case infra
   
       case 1
        let cmnd = 10
         gosub senddata
         
       case 2
        let cmnd = 20
         gosub senddata
        
       case 3
        let cmnd = 30
         gosub senddata
         
       case 4  
        let cmnd= 40
         gosub senddata
        
       case 5
        let cmnd = 50
         gosub senddata
         
       case 6
        let cmnd = 60
         gosub senddata
         
         
   end select
  
   let infra = 0 
    touch16 rts,w5
     if w5 > w1 then 
       
       let cmnd = 70
       gosub senddata
       pause  10 
       
      endif
    
   
    touch16 lts,w8
       if w8 > w2 then 
       
       let cmnd = 80
       gosub senddata
       pause  10 
       
      endif
      
      touch16 lmts,w9
        if w9 > w3 then 
        let cmnd = 90
        gosub senddata
        pause  10 
         
      endif
      
      
      touch16 rmts,w10
        if w10 > w4 then 
        let cmnd = 100
        gosub senddata
        pause  10
        
      endif
      
      
   
   let cmnd = 0
   
   
  loop
  
  
   senddata:
            
               pause 10
         sertxd("cmnd is ",# cmnd,13,10)
            
     	high toduck										' tell MP that data is available
	pulsin fromduck,1, junk				                         ' junk is junk; we're just waiting
	low toduck										' prepare to send data
	
	serout toduck,N2400_4,(cmnd) 
	pause 10
	return
         let cmnd = 0
        
               return
        
        
           
   
 setTsens:
         
         touch16 b.6,w1                         'set top right sensor
          let w1 = w1 + 150
           pause 10
          
         touch16 b.7,w2                         'set top left  sensor
          let w2 = w2 + 200
          pause 10
          
          touch16 b.5,w3
          let w3 = w3 + 150
          pause 10
          
           touch16 b.4,w4
          let w4 = w4 + 200
          pause 10
        
           return
it's only happening when i use W6 it's not major issue and i dont need to use it but I was curious

The 'infra' variable is an alias for 'b13' on the 18M2, and as 'b13' is a part of 'w6' it is affecting that
thx hippy
 

hippy

Ex-Staff (retired)
here the whole code i did'nt miss that much out from post 1 ...
I'm somewhat confused. I'm not sure what you meant by "if i used w6 anywhere it would just keep transmitting the value 70 which i assigned to a touch value" - Neither code in post #1 nor #5 use 'w6' nor seem to output 'w6'.
 

jinx

Senior Member
It's me being stupid again I knew that b13 was the 'infra' variable but when i written it down on paper like
b1 w0
b2
---
b3 w1
b4
--
am always forgetting "B0" when working out which byte variable are in word variable :confused:
Neither code in post #1 nor #5 use 'w6' nor seem to output 'w6'.
because I changed W6 over too another word variable sorry for any confussion.
 
Top