As CoolAirVw has stated, you have a TCCM which controls the transfer case and a PCM which controls the powertrain (engine & transmission). Although ATC is a common acronym for automatic temperature control (not to split hairs - lol).
You have two entirely separate problems going on here with nothing in common between them.
This will get you some explanation about the code you are receiving - P0740 Explained
Now, about your transfer case. CoolAirVw is exactly right here as well, but I will write it a bit differently. If you have a regular 3 button switch on the dash (ie. no Auto4wd option), then you have the NVG233 transfer case which can be diagnosed using the information in the following thread - OBD2 Non-Automatic Transfer Case Diagnostics
. If you have Auto4wd, then you need a real scan tool as stated and things get more complicated (or easier if you have the scan tool as it gives you more information and more diagnostic capability).
We have seen an increase in push button switch replacements here on the forums lately as well. Seems there are more and more problems being traced back to the switch. If I get a chance later, I may see if I can look up the resistance values for the switch so that someone could check it independantly.