HC11 or HC12 question

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With the Atmel AVR, I can read 1 pin from a port as: variable = PINA.0; Does anyone knoe how I do the same with the HC12? The syntax PINA.0 will not compile. Is there another way I can read 1 pin of the entire port to see it's logic level?

Thanks for any help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You might do a lot better to ask your question on a Motorola board. What you are asking is both hardware and compiler specific.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cnewbie wrote:
With the Atmel AVR, I can read 1 pin from a port as: variable = PINA.0; Does anyone knoe how I do the same with the HC12? The syntax PINA.0 will not compile. Is there another way I can read 1 pin of the entire port to see it's logic level?

Thanks for any help!

the syntax PINA.0 is also not ANSI C, and will not compile on many compilers, including others for the AVR.

Also note that the PINA name, is a SFR (special function register) that may be specific to the AVR, or the device you are working with. Not all compilers support SFR's. You will need to consult the compiler documentation for your HC11/12 compiler to see how to access the hardware IO ports. You will likely alos need to look at your HC11/12 datasheets to see what ports to access.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cnewbie wrote:
With the Atmel AVR, I can read 1 pin from a port as: variable = PINA.0; Does anyone knoe how I do the same with the HC12? The syntax PINA.0 will not compile. Is there another way I can read 1 pin of the entire port to see it's logic level?

Thanks for any help!

just use & and | to check the bits....

msb = PORTA & 0x80;

PORTA |= 0x01; //set the lsb

Imagecraft compiler user