Bitwise not working


Results 1 to 15 of 15

Threaded View

  1. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    I think I found the problem.

    Here it is.

    Code:
    1st	i=240		11110000
    	PortB		11110000 'an example.
    	Temp=PORTB	11110000
    	PORTB=Temp & i	11110000
    		
    2nd	i=241		11110001
    	PORTB		11110000
    	Temp=PORTB	11110000
    	PORTB=Temp & i	11110000
    		
    3rd	i=242		11110010
    	PORTB		11110000
    	Temp=PORTB	11110000
    	PORTB=Temp & i	11110000
    .
    ..
    ...
    Etc..

    The first time you get i=240 in decimal. Which is 11110000.
    Then, whatever you "bitwise AND" it with, you will always get 11110000.

    Thus, after 240, you will always have 11110000 because each time loop increments, you assign the previous PORTB value to the temp variable.


    -------------------
    Last edited by sayzer; - 18th October 2006 at 13:13.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. 16F877A with 20MHz XTAL not working?
    By ustredna in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 19th August 2011, 15:04
  2. 2x16 lcd not working with pic16f72
    By vu2iia in forum Schematics
    Replies: 4
    Last Post: - 16th February 2011, 14:59
  3. Blink.Bas on 18f45k20 Newbie seeks working example.
    By DiscoEd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th December 2009, 03:36
  4. Pic 16 F628A not working
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 17th March 2009, 12:26
  5. Hserin not working...
    By robert0 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd August 2005, 12:25

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts